Android reverse engineering

Method 1

apktool+dex2jar+jd-gui

apktool function: the acquisition of resource files, you can extract image files and layout files for viewing
dex2jar function: decompile apk into java source (classes.dex into jar files)
jd-gui: Look at the jar file converted from classes.dex in APK, which is the source file

apktool download address:
https://ibotpeaches.github.io/Apktool/install/
dex2jar download address:
https://sourceforge.net/projects/dex2jar/?source=navbar
jd-gui download address:
http://jd.benow.ca/

1. Resource Decompilation

Download, install and use apktool
First, download the tools apktool needs from the official website: https://ibotpeaches.github.io/Apktool/.
Download address: https://ibotpeaches.github.io/Apktool/install/
Installation steps:
https://ibotpeaches.github.io/Apktool/install/
It's clear that the apktool tool we downloaded needs to be renamed apktool.jar, and the apktool.sh(Linux system) is downloaded and placed in a folder.
The usage is as follows:

apktool.jar     bydr         dial                  googlePinyin.apk  IPVideoTalk_1.0.0.9.apk  kongge_145          MoretvApp3.2.1.apk     Skypeforbusiness.apk
apktool.sh      bydr.apk     dial.apk              googleTalk        IPVideoTalkPro           kongge_145.apk      qq_5.1.1.6062_android  Softphone
linhu@linhu-Lenovo:~/document/Android_Notes/difProject/difTools$ ./apktool.sh --help
Unrecognized option: --help
Apktool v2.3.3 - a tool for reengineering Android apk files
with smali v2.2.2 and baksmali v2.2.2
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>

usage: apktool
 -advance,--advanced   prints advance information.
 -version,--version    prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
 -p,--frame-path <dir>   Stores framework files into <dir>.
 -t,--tag <tag>          Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
 -f,--force              Force delete destination directory.
 -o,--output <dir>       The name of folder that gets written. Default is apk.out
 -p,--frame-path <dir>   Uses framework files located in <dir>.
 -r,--no-res             Do not decode resources.
 -s,--no-src             Do not decode sources.
 -t,--frame-tag <tag>    Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
 -f,--force-all          Skip changes detection and build all files.
 -o,--output <dir>       The name of apk that gets written. Default is dist/name.apk
 -p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: http://ibotpeaches.github.io/Apktool/ 
For smali/baksmali info, see: https://github.com/JesusFreke/smali
linhu@linhu-Lenovo:~/document/Android_Notes/difProject/difTools$

Decompiled resource files:

linhu@linhu-Lenovo:~/document/Android_Notes/difProject/difTools$ ./apktool.sh d -f -s MoretvApp3.2.1.apk 
I: Using Apktool 2.3.3 on MoretvApp3.2.1.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/linhu/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying raw classes.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

2. Source Decompilation

Convert the DEX file retained in the previous step into a jar file using the dex2jar tool

After downloading dex2jar, the classes.dex file is copied to the decompressed directory, and classes.dex is transformed into jar package by. / d2j-dex2jar.sh tool.

linhu@linhu-Lenovo:~/document/Android_Notes/difProject/difTools/dex2jar-2.0$ ls
classes.dex       d2j-dex2jar.bat    d2j-dex2smali.sh                d2j_invoke.bat   d2j-jar2dex.sh      d2j-jasmin2jar.bat  d2j-smali.sh     lib
d2j-baksmali.bat  d2j-dex2jar.sh     d2j-dex-recompute-checksum.bat  d2j_invoke.sh    d2j-jar2jasmin.bat  d2j-jasmin2jar.sh   d2j-std-apk.bat
d2j-baksmali.sh   d2j-dex2smali.bat  d2j-dex-recompute-checksum.sh   d2j-jar2dex.bat  d2j-jar2jasmin.sh   d2j-smali.bat       d2j-std-apk.sh
linhu@linhu-Lenovo:~/document/Android_Notes/difProject/difTools/dex2jar-2.0$ ./d2j-dex2jar.sh classes.dex
dex2jar classes.dex -> ./classes-dex2jar.jar

3. Open jar with jd-gui tool

Open the jar file with the jd-gui tool, and choose to save the source file from the file menu.

Method two

jadx is a very useful decompiling tool, which can decompile java files directly by opening apk.

brief introduction

Jadx is a very useful open source decompilation tool with the following characteristics:

  • Graphical interface.
  • Drag-and-drop operation.
  • Decompiled output Java code.
  • Export Gradle project.

Installation and use

jadx itself is an open source project, and the source code is already open source on Github.

Jadx Github :
Jadx Project Links

Interested can directly clone source code, and then compile it locally. But in most cases, we need a compiled version. The compiled version can be downloaded from sourceforge.

Sorceforge downloads jadx.

For more tips, please refer to the following links:
https://blog.csdn.net/Fisher_3/article/details/78654450

Keywords: github Java Linux Android

Added by Aliz on Fri, 17 May 2019 08:12:04 +0300