About the author: CSDN content partner and technical expert, built an APP with tens of millions of daily users from scratch.
Focus on sharing original series of articles in various fields, specializing in java backend, mobile development, business realization, artificial intelligence, etc. I hope everyone will support me.
No reproduction without permission
Table of contents
1. Introduction
We continue to summarize and studybasic knowledge, review the past and learn the new.
During the development process, we often need to decompile our own apk, and we may also need to look at competing products' solutions. This article records some commonly used decompilation tools.
2. Various tools
2.1 jadx
This is an open source tool, very easy to use
github
Installation:
- Arch linux
sudo pacman -S jadx
- macOS
brew install jadx
查看jadx的安装位置 :
brew list jadx
在shell中直接输入jadx-gui启动jadx的图形化界面,如果不行,可能需配置相应的环境变量
在.bash_profile文件中加入JADX_HOME环境变量并保存
# jadx-gui
JADX_HOME=/opt/homebrew/Cellar/jadx/
PATH=$PATH:${
JADX_HOME}/bin
- Flathub
flatpak install flathub com.github.skylot.jadx
- windows
可直接下载exe文件运行即可
Modify the default running memory size of jadx
- windows system
- Find the jadx.bat file
- Modify set DEFAULT_JVM_OPTS="-Xms128M" "-Xmx4g" "-XX:+UseG1GC"
- Save the file, exit and restart jadx once
- mac
- Switch to the directory where jadx-gui is located:
cd /Users/xx/jadx-decompiler/bin/ - Input vim jadx-gui (Press e to select edit anyway mode, press i to enter insert mode)
- Find a statement like Add default JVM options here. and add it below
DEFAULT_JVM_OPTS='"-Xms1024M" "-Xmx8g"'
- Press the esc key to exit insert mode
- Enter colon: enter the bottom command line mode
- Enter wq to save and exit
2.2 androidkiller
This is also a fool-proof operation and can be downloaded by yourself.
This software may cause errors when decompiling multiple dex, so I wrote a bat file to handle it
dex_2_jar.bat
@echo off
@rem 1 输入工程名 工程名
echo start
echo 输入工程名
set /p projectName=
echo 输入dex名, eg: classes.dex, classes2.dex
set /p dexName=
echo 输入 dex2jar 名 ,eg: classes-dex2jar, classes2-dex2jar.jar
set /p dex2jarName=
echo 输入smali名 ,eg: smali, smali_classes2
set /p smaliName=
echo ===============
echo %projectName%
echo %dexName%
echo %dex2jarName%
echo %smaliName%
pause
if exist classes-dex2jar.jar (
del classes-dex2jar.jar
) else (
echo dex to jar
)
@rem echo e:
@rem cd E:\tool\AndroidKiller_v1.3.1\bin\dex2jar
call E:\tool\AndroidKiller_v1.3.1\bin\dex2jar\d2j-dex2jar.bat E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\%dexName%
pause
move E:\tool\AndroidKiller_v1.3.1\%dex2jarName% E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\
@rem cd /
@rem e:
@rem cd E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\
@rem ren classes-dex2jar.jar %dex2jarName%
pause
set backdir="E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\%smaliName%"
if exist %backdir% (echo "已经存在文件夹") else ( md %backdir% )
pause
"C:\Program Files\WinRAR\WinRAR.exe" x E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\%dex2jarName% E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\%smaliName%"\
@rem 解压classes-dex2jar.jar
@rem E:\tool\AndroidKiller_v1.3.1\projects\%projectName%\ProjectSrc\%smaliName%"\
echo "解压完成"
set projectName=
echo end
pause
Later I found that a big guy wrote a solution, as follows:
Link: https://pan.baidu.com/s/1RwHU0WXyq39Cr9-MqAU-XA< a i=2> Extraction code: 3x6w
The usage method is: After downloading, just put it into the original corresponding directory.
2.3 apktool
apktool git
Easily decompile apk, parse resource files, xml files, generate smali files, and you can also use the modified files to generate apk
Decompile
#mac linux
./apktool d xxx.apk outdir
#window
apktool.bat d xxx.apk outdir
compile
./apktool b apppath outpath
2.4 dex2jar
Convert the dex file in the apk file into a jar file
dex2jar git
download
2.5 jd-gui
jd-gui
jd-gui is mainly used to decompile class files, view jar files, and has a graphical interface.
2.6 Android Crack Tool
The GUI is no longer updated. Users can manually replace the latest version of the jar file into the software for use
github
2.7 GDA
GDA, a powerful Dalvik bytecode decompiler implemented in C++, has the advantages of fast analysis speed, low memory and disk consumption, and has better decompilation capabilities for apk, dex, odex, oat, jar, class, and aar files. powerful.
GDA is also a powerful and fast reverse analysis platform. It not only supports basic decompilation operations, but also supports malicious behavior detection, privacy leakage detection, vulnerability detection, path analysis, packing identification, variable tracking analysis, anti-obfuscation, Python&Java scripts, and devices It has many excellent functions such as memory extraction and data decryption. Encryption etc
2.8 IDAPro
Professional disassembly tools come with a certain learning cost.
3. Recommended reading
Data Structures and Algorithms
Without permission, shall not be reproduced