1. apktool

With apktool, we can decompile and recompile again the Android application file.

apktool d <relative path of apk file>  –  decompile the apk file, (for the dex file, use ‘unzip <apk file>’ instead)

apktool b <relative path of apk file> -o <path to the new apk file>  –  compile the apk file

 

2. adb

Adb is Android Debug Bridge. Here are the basic and most used parameters.

adb devices  –  list available devices

adb shell  –  get the shell to the device, (for exit, type Control + D)

adb -s <ip of the device>:<port of the device> shell  –  get the shell to a certain device

adb shell <shell command>  –  run a certain shell command on the device

adb shell ps | grep <process name>  –  list the output of the ps command for a specific process

adb push <local file path> <remote file path>  –  upload a file to the device

adb pull <remote file path> <local file path>  –  download a file to the device

adb install <apk file>  –  install an apk file to the device

adb uninstall <package name>  –  uninstall an application from the device

adb backup <package name> -f <backup file name>  –  backup an application

adb logcat  –  list the content of the logcat from the device

adb shell pm list packages  –  list the installed packages

adb shell pm path <package name>  –  print the path of a package name

adb shell content query –uri <uri of the content provider>  –  print the data in a content provider

adb forward tcp:<port number> tcp:<port number>  –  port forwarding with adb

 

If adb stops functioning, simply type:

adb kill-server

adb start-server

 

3. unzip

Apk file is actually a zip file. It can be unzipped with unzip tool and the dex file is accessible. The dex file is a compiled jar file for Dalvik VM.

unzip <apk file>

4. jadx

Jadx is a smali decompiler. The source for jadx can be found here and can be built with these commands:

git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew dist

I also put these commands under my tools folder. And the alias:

export JADX_PATH=/home/santokutools/jadx/build/jadx/bin/jadx
export PATH=$PATH:$JADX_PATH

Usage:

jadx <apk file name> -d <output folder>

5. keytool

After unzipping the apk file, the certificate is also accessible. This tool prints the certificate.

keytool -prrintcert -file CERT.RSA

6. d2j-dex2jar and jd-gui

The d2j-dex2jar tool decompiles a dex file and jd-gui displays it in a GUI window. Usage:

d2j-dex2jar <apk file name>
jd-gui <jar file name>

 

7. dexdump

This is another tool to analyze the dex file. Usage:

dexdump -l xml <dex file name>