Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Merge branch 'enhancements'
Browse files Browse the repository at this point in the history
  • Loading branch information
Surendrajat committed Mar 9, 2018
2 parents 798ef0b + 04e0405 commit a237021
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ script:
- cd apkstudio-latest-release
- cp ../apkstudio .

- ../linuxdeployqt*.AppImage apkstudio -bundle-non-qt-libs -no-translations -verbose=2 -appimage
- ../linuxdeployqt*.AppImage apkstudio -bundle-non-qt-libs -no-translations -verbose=2 -appimage -no-copy-copyright-files

# removing doc folder, apprun shortcut and .DirIcon
# - rm -rf doc AppRun .DirIcon
Expand Down
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# APK Studio [![Codacy Badge](https://api.codacy.com/project/badge/Grade/9709de5012824c36b54fda9c2c6390bf)](https://app.codacy.com/app/Surendrajat/apkstudio?utm_source=github.com&utm_medium=referral&utm_content=Surendrajat/apkstudio&utm_campaign=badger) [![Build Status(Linux)](https://travis-ci.org/Surendrajat/ApkStudio.svg)](https://travis-ci.org/Surendrajat/ApkStudio) [![Build status(Windows)](https://ci.appveyor.com/api/projects/status/mnr254lm0mlshmfb?svg=true)](https://ci.appveyor.com/project/Surendrajat/apkstudio) [![Join the chat at https://gitter.im/apk-studio/ideas](https://badges.gitter.im/apk-studio/ideas.svg)](https://gitter.im/apk-studio/ideas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
>**A Cross-Platform IDE for Reverse-Engineering (Decompiling, Hacking & Rebuilding) Android applications - featuring a friendly UI and Code editor which Syntax-highlighting for `smali` files**
>**A Cross-Platform IDE for Reverse-Engineering (Disassembling, Hacking & Rebuilding) Android applications - featuring a friendly UI and Code editor with Syntax-highlighting support**
### Features
- Decompile & Recompile APKs
- Code Editor with Syntax Highlighting (`smali` `xml` `yml` language)
- Flexible Keystore & Key-Alias Chooser
- Automatic *zipalign* & Apk *sign*ing
- Built-in Image viewer for Resources
- One-click App Install to device
- Disassembling & Rebuilding APKs
- Code Editor with Syntax Highlighting (`java` `smali` `xml` `yml`)
- Built-in Image viewer for Resources
- Single-click APK Signing with embedded key-store *(New)*
- Android Signing scheme v2 Support *(New)*
- Flexible Keystore & Key-Alias import
- Automatic Zip-Aligning with embedded `zipalign` *(New)*
- Single-click App Install to device
- Frameworks Support

### Download
Expand All @@ -16,14 +18,18 @@
### Requirements
- **JDK >= 8**
- **Apktool**
[Download](https://bitbucket.org/iBotPeaches/apktool/downloads/) latest `apktool.jar` and put it in the following path:
Download latest [`apktool.jar`](https://bitbucket.org/iBotPeaches/apktool/downloads/) and put it in the following path:
- Linux: `/home/{your-user-name}/.apkstudio/vendor/apktool.jar`
- Windows: `C:\Users\{your-user-name}\.apkstudio\vendor\apktool.jar`

If you've `apktool.jar` already installed in the specified path, replace it with the new one and execute the following command in same path: `java -jar apktool.jar empty-framework-dir --force`
- **adb** driver and **zipalign** utility
- **uber-apk-signer**
Download latest [`uber-apk-signer.jar`](https://github.com/patrickfav/uber-apk-signer/releases) and put it in the following path:
- Linux: `/home/{your-user-name}/.apkstudio/vendor/uber-apk-signer.jar`
- Windows: `C:\Users\{your-user-name}\.apkstudio\vendor\uber-apk-signer.jar`
- **adb** (optional) and **zipalign** (linux_x86 only)
- Ubuntu: `sudo apt-get install android-tools-adb zipalign`
- Windows: [adb driver](https://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378) [zipalign](https://stackoverflow.com/questions/36916462/how-to-zipalign-the-apk-file-in-windows)
- Windows: [adb driver](https://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378)

### Links
- [Building (Command line)](https://github.com/Surendrajat/ApkStudio/wiki/Building#building-linux)
Expand All @@ -33,14 +39,13 @@
- [Special Thanks](https://github.com/Surendrajat/ApkStudio/wiki/SpecialThanks)

### TODO
- Replacing `jarsigner` with [`uber-apk-signer`](https://github.com/patrickfav/uber-apk-signer) ([#issue96](https://github.com/vaibhavpandeyvpz/apkstudio/issues/96))
- [Framework installation](https://ibotpeaches.github.io/Apktool/documentation/#frameworks) within IDE
- Code Completion
- [Framework management](https://ibotpeaches.github.io/Apktool/documentation/#frameworks) within IDE
- Opcode Hex Viewer

### Screenshots
>![Screenshot #1](https://raw.githubusercontent.com/surendrajat/apkstudio/master/external/screenshots/apkstudio000.png "Screenshot #1")
>![Screenshot #1](https://raw.githubusercontent.com/surendrajat/apkstudio/master/external/screenshots/apkstudio881.png "Screenshot #1")
>![Screenshot #2](https://raw.githubusercontent.com/surendrajat/apkstudio/master/external/screenshots/apkstudio002.png "Screenshot #2")
>![Screenshot #2](https://raw.githubusercontent.com/surendrajat/apkstudio/master/external/screenshots/apkstudio882.png "Screenshot #2")
### Disclaimer
>Same as [Apktool](http://ibotpeaches.github.io/Apktool/), **APK Studio** is neither intended for piracy nor other non-legal uses. It could be used for localizing, adding some features or support for custom platforms, analyzing applications & much more.
6 changes: 2 additions & 4 deletions apkstudio.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ HEADERS += \
include/flickcharm.h \
include/ide.h \
include/installrunnable.h \
include/jarsigner.h \
include/java.h \
include/macros.h \
include/menubar.h \
Expand All @@ -43,7 +42,7 @@ HEADERS += \
include/toolbar.h \
include/viewer.h \
include/widgetbar.h \
include/zipalign.h
include/uberapksigner.h

OTHER_FILES += \
.gitignore \
Expand Down Expand Up @@ -88,7 +87,6 @@ SOURCES += \
src/flickcharm.cpp \
src/ide.cpp \
src/installrunnable.cpp \
src/jarsigner.cpp \
src/java.cpp \
src/main.cpp \
src/menubar.cpp \
Expand All @@ -109,7 +107,7 @@ SOURCES += \
src/toolbar.cpp \
src/viewer.cpp \
src/widgetbar.cpp \
src/zipalign.cpp
src/uberapksigner.cpp

TARGET = apkstudio

Expand Down
Binary file removed external/screenshots/apkstudio000.png
Binary file not shown.
Binary file removed external/screenshots/apkstudio002.png
Binary file not shown.
Binary file added external/screenshots/apkstudio881.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added external/screenshots/apkstudio882.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define HIGHLIGHTER_THEME "default.theme"
#define HIGHLIGHTER_STYLE_WHITESPACES "whitespaces"

#define PREF_DEFAULT_JAVA_HEAP 128
#define PREF_DEFAULT_JAVA_HEAP 256
#define PREF_DEFAULT_TAB_STOP_WIDTH 4
#define PREF_DEFAULT_TEXT_ENCODING "UTF-8"

Expand Down Expand Up @@ -54,6 +54,7 @@
#define REGEX_LF "[\\r\\n]"
#define REGEX_ADB_VERSION "^.*(\\d+)\\.(\\d+)\\.(\\d+)$"
#define REGEX_APKTOOL_VERSION "^(\\d+)\\.(\\d+)\\.(\\d+)$"
#define REGEX_UBERAPKTOOL_VERSION "^.*(\\d+)\\.(\\d+)\\.(\\d+)$"
#define REGEX_JAVA_VERSION "^.*\"(\\d+)\\.(\\d+)\\.(\\d+)_(\\d+)\"$"
#define REGEX_THEME_STYLE "\\b([a-z]+)\\:\\s*([0-9a-z#]+)\\b"
#define REGEX_WHITESPACE "\\s+"
Expand Down
1 change: 1 addition & 0 deletions include/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public Q_SLOTS:
void onMenuBarProjectInstall();
void onMenuBarProjectReload();
void onMenuBarProjectSignExport();
void onToolBarProjectSign();
void onOpenApk(const QString &apk);
void onOpenDir(const QString &project);
void onRunnableStarted();
Expand Down
22 changes: 0 additions & 22 deletions include/jarsigner.h

This file was deleted.

31 changes: 31 additions & 0 deletions include/uberapksigner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef UBERAPKSIGNER_H
#define UBERAPKSIGNER_H

#include <QStringList>
#include "macros.h"
#include "java.h"

APP_NAMESPACE_START

class UberApkSigner : public Java
{
private:
QString _jar;
static UberApkSigner *_self;
private:
explicit UberApkSigner(QObject *parent = 0);
public:
// Result build(const QString &project, const QString &apk);
// Result decode(const QString &apk, const QString &project, const QString &framework, const bool sources, const bool resources);
Result sign(const QString &src, const QString &keystore, const QString &keystorePass, const QString &key, const QString &keyPass = QString());
Result signDebug(const QString &src);
inline Result exec(const QString &arg) { return exec(QStringList(arg)); }
Result exec(const QStringList &args = QStringList());
static UberApkSigner *get();
QString getVersion();
};

APP_NAMESPACE_END

#endif // UBERAPKSIGNER_H

22 changes: 0 additions & 22 deletions include/zipalign.h

This file was deleted.

1 change: 1 addition & 0 deletions res/all.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<file>highlight/default.theme</file>
<file>highlight/numbers.def</file>
<file>highlight/smali.def</file>
<file>highlight/java.def</file>
<file>highlight/strings.def</file>
<file>highlight/xml.def</file>
<file>highlight/yml.def</file>
Expand Down
8 changes: 8 additions & 0 deletions res/highlight/java.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ^(import|package)\s[a-zA-Z0-9\.]+\b
keywords \b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|false|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|true|try|void|volatile|while)\b
constants \b[A-Z0-9_]+\b
annotations @[a-zA-Z]+\b
@include numbers.def
@include strings.def
comments //[^\n]*
comments#multiline /\*|\*/
8 changes: 6 additions & 2 deletions res/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
</message>
<message>
<source>sign_export</source>
<translation>Sign/Export</translation>
<translation>Sign/Import</translation>
</message>
<message>
<source>install</source>
Expand Down Expand Up @@ -380,6 +380,10 @@
<source>version_apktool</source>
<translation>APK Tool: %1</translation>
</message>
<message>
<source>version_uberapksigner</source>
<translation>APK Signer: %1</translation>
</message>
<message>
<source>version_java</source>
<translation>Java: %1</translation>
Expand Down Expand Up @@ -461,7 +465,7 @@
</message>
<message>
<source>sign_export</source>
<translation>Sign/Export APK</translation>
<translation>Import KeyStore(Optional) and Sign APK</translation>
</message>
<message>
<source>quit</source>
Expand Down
10 changes: 4 additions & 6 deletions src/consoledock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#include "include/apktool.h"
#include "include/consoledock.h"
#include "include/constants.h"
#include "include/jarsigner.h"
#include "include/uberapksigner.h"
#include "include/qrc.h"
#include "include/zipalign.h"

APP_NAMESPACE_START

Expand Down Expand Up @@ -35,12 +34,11 @@ ConsoleDock::ConsoleDock(QWidget *parent)
_connections << connect(Adb::get(), &Process::executing, this, &ConsoleDock::onExecuting);
_connections << connect(ApkTool::get(), &Process::executed, this, &ConsoleDock::onExecuted);
_connections << connect(ApkTool::get(), &Process::executing, this, &ConsoleDock::onExecuting);
_connections << connect(JarSigner::get(), &Process::executed, this, &ConsoleDock::onExecuted);
_connections << connect(JarSigner::get(), &Process::executing, this, &ConsoleDock::onExecuting);
_connections << connect(UberApkSigner::get(), &Process::executed, this, &ConsoleDock::onExecuted);
_connections << connect(UberApkSigner::get(), &Process::executing, this, &ConsoleDock::onExecuting);
_connections << connect(Java::get(), &Process::executed, this, &ConsoleDock::onExecuted);
_connections << connect(Java::get(), &Process::executing, this, &ConsoleDock::onExecuting);
_connections << connect(ZipAlign::get(), &Process::executed, this, &ConsoleDock::onExecuted);
_connections << connect(ZipAlign::get(), &Process::executing, this, &ConsoleDock::onExecuting);

}

void ConsoleDock::onExecuted(const Process::Result &r)
Expand Down
14 changes: 14 additions & 0 deletions src/ide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,20 @@ void Ide::onMenuBarProjectSignExport()
}
}

void Ide::onToolBarProjectSign()
{

if (_apk.isNull() || _apk.isEmpty())
{
QMessageBox::warning(this, __("no_apk", "titles"), __("no_apk", "messages"), QMessageBox::Close);
}
else
{
Preferences *p = Preferences::get();
Runner::get()->add(new SignRunnable(_apk, p->signKeystore(), p->signKeystorePass(), p->signKey(), p->signKeyPass(), this));
}
}

void Ide::onOpenApk(const QString &p)
{
(new PreOpenApk(p, this))->exec();
Expand Down
38 changes: 0 additions & 38 deletions src/jarsigner.cpp

This file was deleted.

21 changes: 7 additions & 14 deletions src/signrunnable.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <QFile>
#include "include/jarsigner.h"
#include "include/uberapksigner.h"
#include "include/pathutils.h"
#include "include/signrunnable.h"
#include "include/zipalign.h"

APP_NAMESPACE_START

Expand All @@ -16,20 +15,14 @@ SignRunnable::SignRunnable(const QString &s, const QString &ks, const QString &k
void SignRunnable::run()
{
emit runnableStarted();
QString tmp = PathUtils::temp("signed.apk");
Process::Result r = JarSigner::get()->sign(_src, tmp, _keystore, _keystorePass, _key, _keyPass);
Process::Result r;
if(_keystore.isEmpty())
r = UberApkSigner::get()->signDebug(_src);
else
r = UberApkSigner::get()->sign(_src, _keystore, _keystorePass, _key, _keyPass);
if (r.code == 0)
{
r = ZipAlign::get()->align(tmp, _src);
if (r.code == 0)
{
emit signSuccess(_src);
}
else
{
emit signFailure(_src);
}
QFile::remove(tmp);
emit signSuccess(_src);
}
else
{
Expand Down
Loading

0 comments on commit a237021

Please sign in to comment.