The use of decompilation tools in the Mac environment

It is unavoidable in daily work that decompilation tools are often installed (changing computer equipment, deleting folders by hand, etc.), and forgetting to use commands after a long time, so make a record.

1. Three-piece set of decompilation tools

  1. apktool: Get resource files, configuration files, manifest files, so packages in the lib folder, etc. in the apk
  2. dex2jar: decompile apk into java source code, and convert dex files into jar files
  3. jd-gui: a visual tool for viewing jar files decompiled by dex2jar

2. Download, installation and use of decompilation tools

1. Download of apktool: download link

Take Mac as an example

  1. Put the mouse on the wrapper script in step 1 of the screenshot, right-click and select the link to save as, and then name it apktool (note that this file does not add any suffix name)
  2. download apktool-2
  3. Change the jar name downloaded in step 2 to apktool.jar
  4. Move the two files downloaded in the above steps to the /user/local/bin folder
  5. Set these two files as executable files (chmod a+x file name)
//在终端分别执行如下俩命令
chmod a+x /usr/local/bin/apktool
chmod a+x /usr/local/bin/apktool.jar 

Verify that the installation was successful

//终端运行如下命令 如果有版本号即可成功
apktool -version

The use of apktool:
Use the cd command to enter the directory where the apk is located, and then execute the following command

//会生成同名的文件夹
apktool d -r ***.apk

2. dex2jar download : After the download link
is opened, there is a release package on the right side of the page for you to download,
insert image description here
and you can unzip it after downloading

The use of dex2jar
changes the apk suffix to .zip. After decompression, there will be a classes.dex file. Put the classes.dex file into the folder decompressed by dex2jar, and execute the following command to generate the jar file classes-dex2jar.jar. In order View the source code of the classes-dex2jar.jar file, and then we need the jd-gui tool to open it

sh d2j-dex2jar.sh classes.dex

3. Download link of jd-gui tool
insert image description here

After downloading and decompressing, there is JD-GUI in the folder. Double-click to open it and use it. If prompted,
insert image description here
first check whether there is a java1.8+ version environment. If the environment is ok, then there is a problem with the software itself. You need to modify the content of the following files :
Display package content (JD-GUI) Find the file
insert image description here
and cover all the content in the correct configuration information link to the above file to solve the problem.

Use of JD-GUI
Just drag the jar file generated by dex2jar into JD-GUI.

Guess you like

Origin blog.csdn.net/qq_36356379/article/details/127432082