Coder Social home page Coder Social logo

codehasan / dex2c Goto Github PK

View Code? Open in Web Editor NEW
128.0 0.0 33.0 26.5 MB

๐ŸŽ‡ AOT compiler to translate dalvikvm code into cpp code

License: Apache License 2.0

C++ 2.28% Python 96.31% C 0.49% Makefile 0.04% Smali 0.04% Shell 0.74% Batchfile 0.10%
jni-wrapper python3 apk-strengthening dcc dex2c

dex2c's Introduction

๐ƒ๐ž๐ฑ๐Ÿ๐‚

Stars Python Forks Size Contributors License

Method-based AOT compiler that can wrap Dalvik bytecode with JNI native code.

Table of contents
  1. About the project
  2. Installation
  3. Usage
  4. How to change lib name
  5. Roadmap
  6. Contributing
  7. License
  8. Acknowledgments

About the project

This project is a forked version of amimo/dcc, which aims to make it easy for everyone to use this tool. We automated plenty of processes that you had to do manually in the original DCC. Moreover, we always try to add new features to make this tool more usable in real-world applications. Check out Roadmap to know about the changes we made and also the changes we are planning to make in the feature.

Built with

  • Python
  • Androguard

Installation

Python 3.8 or higher is required for running this tool. So, make sure your python is up-to-date.

  1. Clone the repo.
    git clone https://github.com/codehasan/dex2c
  2. Open the cloned directory.
    cd dex2c
  3. Download Apktool latest version from bitbucket and save it in tools folder with the name apktool.jar
    wget -O tools/apktool.jar https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.9.3.jar
  4. Download android NDK for your OS and extract it. Copy the folder path where ndk-build executable is located inside the extracted folder and configure ndk_dir in dcc.cfg

Linux

Linux

  1. Install required dependencies.
    pip3 install -r requirements.txt
  2. Install JRE/JDK if you don't have it installed. The recommended JDK version is 11.
    sudo apt-get install openjdk-11-jdk

Windows

Windows

  1. Install required dependencies.
    pip3 install -r requirements.txt
  2. Install JRE/JDK from oracle if you don't have it installed. Search in Google, how to install JDK in Windows if you need more guidance on this topic. The recommended JDK version is 11.

Termux

Android

One Step Installation: Run Below Command

pkg install wget && wget -O termux_install.sh https://raw.githubusercontent.com/codehasan/dex2c/master/termux_install.sh && chmod -R +x termux_install.sh && ./termux_install.sh

NOTE: Some users have reported about installation errors with latest clang on termux. If you happen to face the same issue, then uncomment the lines stated in termux_install.sh and then proceed with the installation.

Usage

Filters

Add all your filters in filter.txt file - one rule for each line. Filters are made using regex patterns. There are two types of filters available in Dex2c - whitelist, and blacklist. You can use them whenever you need them.

WhiteList

  • Protect just one method in a specific class.
com/some/class;some_method(some_parameters)return_type
  • Protect all methods in a specific class.
com/some/class;.*
  • Protect all methods in all classes under a package path.
com/some/package/.*;.*
  • Protect a method with the name onCreate in all classes.
.*;onCreate\(.*

BlackList

Adding an exclamation ! sign before a rule will mark that rule as a blacklist.

  • Exclude one method in a specific class from being protected.
!com/some/class;some_method(some_parameters)return_type
  • Exclude all methods in a specific class from being protected.
!com/some/class;.*
  • Exclude all methods in all classes under a package path from being protected.
!com/some/package/.*;.*
  • Exclude a method with the name onCreate in all classes from being protected.
!.*;onCreate\(.*

Protect apps

  • Copy your apk file to dex2c folder where dcc.py is located and run this command.
python3 dcc.py -a input.apk -o output.apk
  • Run this command to know about all the other options available in dcc to find the best ones for your needs.
python3 dcc.py --help

How to change lib name

Open project/jni/Android.mk file in the cloned directory. You will find a variable named LOCAL_MODULE, initially with the value stub. Please change it to your desired lib name. Keep in mind the following instructions to prevent possible errors.

  • Don't use spaces in lib name, use hyphen - or underscore _
  • Don't use any kind of symbols or punctuations in lib name other than underscores and hyphens
  • Don't start the lib name with the text lib itself

Roadmap

  • Add custom lib loader
  • Add new apksigner
  • Add multi-dex support
  • Add app abi handler
  • Add signature configuration in dcc.cfg
  • Add new options
    • --skip-synthetic
    • --custom-loader
    • --force-keep-libs
    • --obfuscate

See the open issues for a full list of proposed features and known issues.

Contributing

Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give this project a star! Thanks again!

  1. Fork the project
  2. Create your feature branch. (git checkout -b feature/AmazingFeature)
  3. Commit your changes. (git commit -m 'Add some AmazingFeature')
  4. Push to the branch. (git push origin feature/AmazingFeature)
  5. Open a pull request.

License

Distributed under the Apache License. See LICENSE.txt for more information.

Acknowledgments

Projects

People

Go to top

dex2c's People

Contributors

abhithemodder avatar codehasan avatar kirlif avatar lry127 avatar luoyesiqiu avatar nicechin avatar redragon14368 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dex2c's Issues

Termux android error

make: Leaving directory '/data/data/com.termux/files/home/dex2c/.tmp/dcc-project-eQ3UZ4LF' tools/apktool: line 77: exec: java: not found [ERROR ] dcc: Compile fb64.apk failed!
Traceback (most recent call last): File "/data/data/com.termux/files/home/dex2c/dcc.py", line 1014, in
dcc_main( File "/data/data/com.termux/files/home/dex2c/dcc.py", line 783, in dcc_main
decompiled_dir = ApkTool.decompile(apkfile) ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/home/dex2c/dcc.py", line 118, in decompile
check_call(['bash', APKTOOL3, 'd', '-r', '-f', '-o', outdir, apk])
File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['bash', 'tools/apktool', 'd', '-r', '-f', '-o', '.tmp/dcc-apktool-ZU6r9vxB', 'fb64.apk']' returned non-zero exit status 127. Command '['bash', 'tools/apktool', 'd', '-r', '-f', '-o', '.tmp/dcc-apktool-ZU6r9vxB', 'fb64.apk']' returned non-zero exit status 127.
[INFO ] dcc: Restoring jni folder [INFO ] dcc: Removing .tmp folder

How to fix this

PS C:\Users\bualt\PycharmProjects\dex2c> python3 dcc.py -a test.apk -o output.apk
Traceback (most recent call last):
File "C:\Users\bualt\PycharmProjects\dex2c\dcc.py", line 14, in
from androguard.core.analysis import analysis
File "C:\Users\bualt\PycharmProjects\dex2c\androguard\core\analysis\analysis.py", line 8, in
from androguard.core.bytecodes import dvm
File "C:\Users\bualt\PycharmProjects\dex2c\androguard\core\bytecodes\dvm.py", line 8, in
from androguard.core.bytecodes.apk import APK
File "C:\Users\bualt\PycharmProjects\dex2c\androguard\core\bytecodes\apk.py", line 7, in
from androguard.util import read, get_certificate_name_string
File "C:\Users\bualt\PycharmProjects\dex2c\androguard\util.py", line 1, in
import asn1crypto
ModuleNotFoundError: No module named 'asn1crypto'

Error while running with python 3.11

Traceback (most recent call last):
File "D:\project\newsvn\dsj\ours\tools\dex2c\dcc.cfg", line 9, in
"v1_enabled": true,
^^^^
NameError: name 'true' is not defined. Did you mean: 'True'?

what's wrong?

apktool error

[ERROR ] dcc: Compile input.apk failed!
Traceback (most recent call last):
File "D:\dex2c-master\dcc.py", line 1017, in
dcc_main(
File "D:\dex2c-master\dcc.py", line 786, in dcc_main
decompiled_dir = ApkTool.decompile(apkfile)
File "D:\dex2c-master\dcc.py", line 116, in decompile
check_call([APKTOOL2, 'd', '-r', '-f', '-o', outdir, apk])
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['tools/apktool.bat', 'd', '-r', '-f', '-o', '.tmp\dcc-apktool-4iKgmTdI', 'input.apk']' returned non-zero exit status 1.
Command '['tools/apktool.bat', 'd', '-r', '-f', '-o', '.tmp\dcc-apktool-4iKgmTdI', 'input.apk']' returned non-zero exit status 1.

NDK build error

I got the following error. What does it mean?

[WARNING ] dcc: ================================
"D:\AndroidSDK\ndk\26.2.11394342\build\..\prebuilt\windows-x86_64\bin\make.exe": Interrupt/Exception caught (code = 0xc00000fd, addr = 0x00007ff684dc9950)
[ERROR   ] dcc: Compile F:\xxx.apk failed!
Traceback (most recent call last):
  File "F:\Github\dex2c\dcc.py", line 1017, in <module>
    dcc_main(
  File "F:\Github\dex2c\dcc.py", line 783, in dcc_main
    build_project(project_dir)
  File "F:\Github\dex2c\dcc.py", line 248, in build_project
    check_call([NDKBUILD, "-j%d" % cpu_count(), "-C", project_dir], stderr=STDOUT)
  File "D:\Python3\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['D:/AndroidSDK/ndk/26.2.11394342\\ndk-build.cmd', '-j8', '-C', '.tmp\\dcc-project-zkaTk3xY']' returned non-zero exit status 255.
Command '['D:/AndroidSDK/ndk/26.2.11394342\\ndk-build.cmd', '-j8', '-C', '.tmp\\dcc-project-zkaTk3xY']' returned non-zero exit status 255.
[INFO    ] dcc: Restoring jni folder
[INFO    ] dcc: Removing .tmp folder

Failed to generate valid c++ file because of type mismatch

Error message:

[armeabi-v7a] Compile++ thumb: stub <= Java_com_simplemobiletools_commons_databases_ContactsDatabase_1Impl_clearAllTables__.cpp
jni/nc/Java_com_simplemobiletools_commons_databases_ContactsDatabase_1Impl_clearAllTables__.cpp:244:24: error: cannot initialize a member subobject of type 'jobject' (aka '_jobject *') with an lvalue of type 'jint' (aka 'int')
jvalue args[] = {{.l = v7}};
                       ^~
1 error generated.

the corresponding smali code:

.method public clearAllTables()V
    .registers 5

    .line 163
    const-string v0, "VACUUM"

    const-string v1, "PRAGMA wal_checkpoint(FULL)"

    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->assertNotMainThread()V

    .line 164
    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->getOpenHelper()Landroidx/sqlite/db/SupportSQLiteOpenHelper;

    move-result-object v2

    invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteOpenHelper;->getWritableDatabase()Landroidx/sqlite/db/SupportSQLiteDatabase;

    move-result-object v2

    .line 166
    .local v2, "_db":Landroidx/sqlite/db/SupportSQLiteDatabase;
    :try_start_f
    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->beginTransaction()V

    .line 167
    const-string v3, "DELETE FROM `contacts`"

    invoke-interface {v2, v3}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 168
    const-string v3, "DELETE FROM `groups`"

    invoke-interface {v2, v3}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 169
    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->setTransactionSuccessful()V
    :try_end_1f
    .catchall {:try_start_f .. :try_end_1f} :catchall_33

    .line 171
    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->endTransaction()V

    .line 172
    invoke-interface {v2, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 173
    invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->inTransaction()Z

    move-result v1

    if-nez v1, :cond_32

    .line 174
    invoke-interface {v2, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 177
    :cond_32
    return-void

    .line 171
    :catchall_33
    move-exception v3

    invoke-super {p0}, Lcom/simplemobiletools/commons/databases/ContactsDatabase;->endTransaction()V

    .line 172
    invoke-interface {v2, v1}, Landroidx/sqlite/db/SupportSQLiteDatabase;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 173
    invoke-interface {v2}, Landroidx/sqlite/db/SupportSQLiteDatabase;->inTransaction()Z

    move-result v1

    if-nez v1, :cond_47

    .line 174
    invoke-interface {v2, v0}, Landroidx/sqlite/db/SupportSQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 176
    :cond_47
    throw v3
.end method

Jadx decompiled method:

    @Override // androidx.room.RoomDatabase
    public void clearAllTables() {
        super.assertNotMainThread();
        SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase();
        try {
            super.beginTransaction();
            _db.execSQL("DELETE FROM `contacts`");
            _db.execSQL("DELETE FROM `groups`");
            super.setTransactionSuccessful();
        } finally {
            super.endTransaction();
            _db.query("PRAGMA wal_checkpoint(FULL)").close();
            if (!_db.inTransaction()) {
                _db.execSQL("VACUUM");
            }
        }
    }

Generated c++ code:

#include "Dex2C.h"

/* Lcom/simplemobiletools/commons/databases/ContactsDatabase_Impl;->clearAllTables()V */
extern "C" JNIEXPORT void JNICALL
Java_com_simplemobiletools_commons_databases_ContactsDatabase_1Impl_clearAllTables__(JNIEnv *env, jobject thiz){
jobject v0 = NULL;
jobject v1 = NULL;
jobject v2 = NULL;
jobject v3 = NULL;
jobject v4 = NULL;
jobject v5 = NULL;
jint v6;
jint v7;
jthrowable exception;
jclass cls0 = NULL,cls1 = NULL,cls2 = NULL,cls3 = NULL;
jmethodID mth0 = NULL, mth1 = NULL, mth2 = NULL, mth3 = NULL, mth4 = NULL, mth5 = NULL, mth6 = NULL, mth7 = NULL, mth8 = NULL, mth9 = NULL;
v0 = (jobject)env->NewLocalRef(thiz);
L0:
LOGD("0:const-string \x76\x30\x2c\x20\x27\x56\x41\x43\x55\x55\x4d\x27");
if (v1) {
LOGD("env->DeleteLocalRef(%p):v1", v1);
env->DeleteLocalRef(v1);
}
v1 = (jstring) env->NewStringUTF("\x56\x41\x43\x55\x55\x4d");
LOGD("4:const-string \x76\x31\x2c\x20\x27\x50\x52\x41\x47\x4d\x41\x20\x77\x61\x6c\x5f\x63\x68\x65\x63\x6b\x70\x6f\x69\x6e\x74\x28\x46\x55\x4c\x4c\x29\x27");
if (v2) {
LOGD("env->DeleteLocalRef(%p):v2", v2);
env->DeleteLocalRef(v2);
}
v2 = (jstring) env->NewStringUTF("\x50\x52\x41\x47\x4d\x41\x20\x77\x61\x6c\x5f\x63\x68\x65\x63\x6b\x70\x6f\x69\x6e\x74\x28\x46\x55\x4c\x4c\x29");
LOGD("8:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x61\x73\x73\x65\x72\x74\x4e\x6f\x74\x4d\x61\x69\x6e\x54\x68\x72\x65\x61\x64\x28\x29\x56");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth0;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "assertNotMainThread", "()V");
jvalue args[] = {};
env->CallNonvirtualVoidMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("e:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x67\x65\x74\x4f\x70\x65\x6e\x48\x65\x6c\x70\x65\x72\x28\x29\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x4f\x70\x65\x6e\x48\x65\x6c\x70\x65\x72\x3b");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth1;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "getOpenHelper", "()Landroidx/sqlite/db/SupportSQLiteOpenHelper;");
jvalue args[] = {};
v3 = (jobject) env->CallNonvirtualObjectMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("14:move-result-object \x76\x32");
if (v4) {
LOGD("env->DeleteLocalRef(%p):v4", v4);
env->DeleteLocalRef(v4);
}
v4 = (jobject) v3;
LOGD("16:invoke-interface \x76\x32\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x4f\x70\x65\x6e\x48\x65\x6c\x70\x65\x72\x3b\x2d\x3e\x67\x65\x74\x57\x72\x69\x74\x61\x62\x6c\x65\x44\x61\x74\x61\x62\x61\x73\x65\x28\x29\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v4);
jclass &clz = cls1;
jmethodID &mid = mth2;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteOpenHelper", "getWritableDatabase", "()Landroidx/sqlite/db/SupportSQLiteDatabase;");
jvalue args[] = {};
v3 = (jobject) env->CallObjectMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("1c:move-result-object \x76\x32");
if (v4) {
LOGD("env->DeleteLocalRef(%p):v4", v4);
env->DeleteLocalRef(v4);
}
v4 = (jobject) v3;
L1:
LOGD("1e:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x62\x65\x67\x69\x6e\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x28\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth3;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "beginTransaction", "()V");
jvalue args[] = {};
env->CallNonvirtualVoidMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("24:const-string \x76\x33\x2c\x20\x27\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x60\x63\x6f\x6e\x74\x61\x63\x74\x73\x60\x27");
if (v5) {
LOGD("env->DeleteLocalRef(%p):v5", v5);
env->DeleteLocalRef(v5);
}
v5 = (jstring) env->NewStringUTF("\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x60\x63\x6f\x6e\x74\x61\x63\x74\x73\x60");
LOGD("28:invoke-interface \x76\x32\x2c\x20\x76\x33\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x78\x65\x63\x53\x51\x4c\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth4;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "execSQL", "(Ljava/lang/String;)V");
jvalue args[] = {{.l = v5}};
env->CallVoidMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("2e:const-string \x76\x33\x2c\x20\x27\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x60\x67\x72\x6f\x75\x70\x73\x60\x27");
if (v5) {
LOGD("env->DeleteLocalRef(%p):v5", v5);
env->DeleteLocalRef(v5);
}
v5 = (jstring) env->NewStringUTF("\x44\x45\x4c\x45\x54\x45\x20\x46\x52\x4f\x4d\x20\x60\x67\x72\x6f\x75\x70\x73\x60");
LOGD("32:invoke-interface \x76\x32\x2c\x20\x76\x33\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x78\x65\x63\x53\x51\x4c\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth4;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "execSQL", "(Ljava/lang/String;)V");
jvalue args[] = {{.l = v5}};
env->CallVoidMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("38:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x73\x65\x74\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x53\x75\x63\x63\x65\x73\x73\x66\x75\x6c\x28\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth5;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "setTransactionSuccessful", "()V");
jvalue args[] = {};
env->CallNonvirtualVoidMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("3e:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x6e\x64\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x28\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth6;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "endTransaction", "()V");
jvalue args[] = {};
env->CallNonvirtualVoidMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("44:invoke-interface \x76\x32\x2c\x20\x76\x31\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x71\x75\x65\x72\x79\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x4c\x61\x6e\x64\x72\x6f\x69\x64\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x2f\x43\x75\x72\x73\x6f\x72\x3b");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth7;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "query", "(Ljava/lang/String;)Landroid/database/Cursor;");
jvalue args[] = {{.l = v2}};
v3 = (jobject) env->CallObjectMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("4a:move-result-object \x76\x31");
if (v2) {
LOGD("env->DeleteLocalRef(%p):v2", v2);
env->DeleteLocalRef(v2);
}
v2 = (jobject) v3;
LOGD("4c:invoke-interface \x76\x31\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x2f\x43\x75\x72\x73\x6f\x72\x3b\x2d\x3e\x63\x6c\x6f\x73\x65\x28\x29\x56");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v2);
jclass &clz = cls3;
jmethodID &mid = mth8;
D2C_RESOLVE_METHOD(clz, mid, "android/database/Cursor", "close", "()V");
jvalue args[] = {};
env->CallVoidMethodA(v2, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("52:invoke-interface \x76\x32\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x69\x6e\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x28\x29\x5a");
{
#define EX_HANDLE EX_LandingPad_1
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth9;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "inTransaction", "()Z");
jvalue args[] = {};
v6 = (jboolean) env->CallBooleanMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("58:move-result \x76\x31");
v7 = (jint) v6;
LOGD("5a:if-nez \x76\x31\x2c\x20\x2b\x35");
if(v7 != 0){
goto L3;
}
else {
goto L2;
}
L2:
LOGD("5e:invoke-interface \x76\x32\x2c\x20\x76\x30\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x78\x65\x63\x53\x51\x4c\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x56");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth4;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "execSQL", "(Ljava/lang/String;)V");
jvalue args[] = {{.l = v1}};
env->CallVoidMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
L3:
return;
L4:
LOGD("66:move-exception \x76\x33");
if (v5) {
LOGD("env->DeleteLocalRef(%p):v5", v5);
env->DeleteLocalRef(v5);
}
v5 = exception;
LOGD("68:invoke-super \x76\x34\x2c\x20\x4c\x63\x6f\x6d\x2f\x73\x69\x6d\x70\x6c\x65\x6d\x6f\x62\x69\x6c\x65\x74\x6f\x6f\x6c\x73\x2f\x63\x6f\x6d\x6d\x6f\x6e\x73\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x73\x2f\x43\x6f\x6e\x74\x61\x63\x74\x73\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x6e\x64\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x28\x29\x56");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v0);
jclass &clz = cls0;
jmethodID &mid = mth6;
D2C_RESOLVE_METHOD(clz, mid, "com/simplemobiletools/commons/databases/ContactsDatabase", "endTransaction", "()V");
jvalue args[] = {};
env->CallNonvirtualVoidMethodA(v0, clz, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("6e:invoke-interface \x76\x32\x2c\x20\x76\x31\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x71\x75\x65\x72\x79\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x4c\x61\x6e\x64\x72\x6f\x69\x64\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x2f\x43\x75\x72\x73\x6f\x72\x3b");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth7;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "query", "(Ljava/lang/String;)Landroid/database/Cursor;");
jvalue args[] = {{.l = v7}};
v3 = (jobject) env->CallObjectMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("74:move-result-object \x76\x31");
if (v2) {
LOGD("env->DeleteLocalRef(%p):v2", v2);
env->DeleteLocalRef(v2);
}
v2 = (jobject) v3;
LOGD("76:invoke-interface \x76\x31\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x2f\x64\x61\x74\x61\x62\x61\x73\x65\x2f\x43\x75\x72\x73\x6f\x72\x3b\x2d\x3e\x63\x6c\x6f\x73\x65\x28\x29\x56");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v2);
jclass &clz = cls3;
jmethodID &mid = mth8;
D2C_RESOLVE_METHOD(clz, mid, "android/database/Cursor", "close", "()V");
jvalue args[] = {};
env->CallVoidMethodA(v2, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("7c:invoke-interface \x76\x32\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x69\x6e\x54\x72\x61\x6e\x73\x61\x63\x74\x69\x6f\x6e\x28\x29\x5a");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth9;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "inTransaction", "()Z");
jvalue args[] = {};
v6 = (jboolean) env->CallBooleanMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
LOGD("82:move-result \x76\x31");
v7 = (jint) v6;
LOGD("84:if-nez \x76\x31\x2c\x20\x2b\x35");
if(v7 != 0){
goto L6;
}
else {
goto L5;
}
L5:
LOGD("88:invoke-interface \x76\x32\x2c\x20\x76\x30\x2c\x20\x4c\x61\x6e\x64\x72\x6f\x69\x64\x78\x2f\x73\x71\x6c\x69\x74\x65\x2f\x64\x62\x2f\x53\x75\x70\x70\x6f\x72\x74\x53\x51\x4c\x69\x74\x65\x44\x61\x74\x61\x62\x61\x73\x65\x3b\x2d\x3e\x65\x78\x65\x63\x53\x51\x4c\x28\x4c\x6a\x61\x76\x61\x2f\x6c\x61\x6e\x67\x2f\x53\x74\x72\x69\x6e\x67\x3b\x29\x56");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v4);
jclass &clz = cls2;
jmethodID &mid = mth4;
D2C_RESOLVE_METHOD(clz, mid, "androidx/sqlite/db/SupportSQLiteDatabase", "execSQL", "(Ljava/lang/String;)V");
jvalue args[] = {{.l = v1}};
env->CallVoidMethodA(v4, mid, args);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}
L6:
LOGD("8e:throw \x76\x33");
{
#define EX_HANDLE EX_UnwindBlock
D2C_NOT_NULL(v5);
env->Throw((jthrowable) v5);
D2C_CHECK_PENDING_EX;
#undef EX_HANDLE
}

EX_LandingPad_1:
D2C_GET_PENDING_EX
if(d2c_is_instance_of(env, exception, "java/lang/Throwable")) {
goto L4;
}
D2C_GOTO_UNWINDBLOCK
EX_UnwindBlock: return;
}

filter.txt:

.*ContactsDatabase.*

Python environment: Python 3.12.3
OS: Linux ubuntu 24.04
command executed:

python3 dcc.py -a classes.dex -o out  --source-dir proj-src

P.S. the dex file is here. Besides, I fixed a bug in this PR to make debugging a single dex file possible, it would otherwise throw a exception because the auto_vm method would return a list of bytes if a single dex file was provided.
Any help is really appreciated and more info can be provided if needed. :)

Termux: Wrong path in shellrc

After setup is done on shellrc file the PATH to NDK is being wrongly saved as $ndk_version directly where there should have been correct version.
image

'tools' is not recognized as an internal or external command

I'm getting this error protecting my simple app. It says that tools is not recognized, but what tools excatly? I have NDK, apktool and required dependencies installed

I'm using Windows 11 23h2 with Python 3.11.6 installed

make: Entering directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
[armeabi-v7a] Install        : libstub.so => libs/armeabi-v7a/libstub.so
make: Leaving directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
make: Entering directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
[arm64-v8a] SharedLibrary  : libstub.so
make: Leaving directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
make: Entering directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
[arm64-v8a] Install        : libstub.so => libs/arm64-v8a/libstub.so
make: Leaving directory 'F:/Github/dex2c/.tmp/dcc-project-6umijLvV'
'tools' is not recognized as an internal or external command,
operable program or batch file.
[ERROR   ] dcc: Compile H:\apptest.apk failed!
Traceback (most recent call last):
  File "F:\Github\dex2c\dcc.py", line 1017, in <module>
    dcc_main(
  File "F:\Github\dex2c\dcc.py", line 786, in dcc_main
    decompiled_dir = ApkTool.decompile(apkfile)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\Github\dex2c\dcc.py", line 116, in decompile
    check_call([APKTOOL2, 'd', '-r', '-f', '-o', outdir, apk])
  File "D:\Python3\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['tools/apktool.bat', 'd', '-r', '-f', '-o', '.tmp\\dcc-apktool-eLRN6Og0', 'H:\\apptest.apk']' returned non-zero exit status 1.
Command '['tools/apktool.bat', 'd', '-r', '-f', '-o', '.tmp\\dcc-apktool-eLRN6Og0', 'H:\\apptest.apk']' returned non-zero exit status 1.
[INFO    ] dcc: Restoring jni folder
[INFO    ] dcc: Removing .tmp folder

Error when running on termux (phone)

On pc, I put in dcc.cfg "ndk_dir": "ndk-build", And I put the ndk-build folder in the dex2c folder, everything runs normally, but when I bring it up to termux (phone), I get an error that the ndk-build folder cannot be found.
Screenshot_2023-10-01-04-13-09-880_com termux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.