kyzsuukii / dex2c

dex2c aka dcc is a method-based aot compiler that can translate dalvikvm code into cpp code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πƒπžπ±πŸπ‚

Stars Python Forks Size Contributors License

Method based AOT compiler that can wrap dalvik bytecode with jni native code.

Table of contents

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 process that you had to do manually in 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/ratsan/dex2c
  2. Open the cloned directory.
    cd dex2c
  3. Download apktool latest version from bitbucket and save it in tools folder with name apktool.jar
    wget -O tools/apktool.jar https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.7.0.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

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

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. Recommended jdk version is 11.

Usage

Filters

Add all your filters in filter.txt file - one rule each line. Filters are are made using regex patterns. There are two types of filters avilable in dcc - whitelist, blacklist. Use them according to your need.

WhiteList

  • Protect just one method in a specific class. It's just a demo.
com/some/class;some_method(some_parameters)return_type
  • Protect all methods in a specific class. It's also just a demo.
com/some/class;.*
  • Protect all methods in all classes under a package path. It's also just a demo.
com/some/package/.*;.*
  • Protect a method with the name onCreate in all classes. It's also just a demo.
.*;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. It's just a demo.
!com/some/class;some_method(some_parameters)return_type
  • Exclude all methods in a specific class from being protected. It's also just a demo.
!com/some/class;.*
  • Exclude all methods in all classes under a package path from being protected. It's also just a demo.
!com/some/package/.*;.*
  • Exclude a method with the name onCreate in all classes from being protected. It's also just a demo.
!.*;onCreate\(.*

Protect apps

  • Copy your apk file in 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 need.
python3 dcc.py --help

How to change lib name

Open project/jni/Android.mk file in cloned directory. You will find a variable named LOCAL_MODULE, which will initially have the value stub. Change it to your desired lib name. Keep in mind,

  • Don't use spaces in lib name, use hyphen - or underscore _
  • Don't use any other kind of symbols or punctuations in lib name
  • Don't start 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 make 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

About

dex2c aka dcc is a method-based aot compiler that can translate dalvikvm code into cpp code

License:Apache License 2.0


Languages

Language:Python 97.1%Language:C++ 2.3%Language:C 0.5%Language:Makefile 0.0%Language:Smali 0.0%