TLDRBins TLDRBins / Android


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Unpack .apk file

# Get .smali files java -jar apktool_2.9.3.jar d <FILE>
Sample Output: TO-DO
# Get .java files jadx <FILE>
Sample Output: TO-DO

Ref: apktool
Ref: jadx


Re-pack .apk file

1. Initial pack

java -jar apktool_2.9.3.jar b --use-aapt2 <APP> -o <APP>_repacked.apk
Sample Output: TO-DO

2. zip align

zipalign

3. Sign the apk

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
Sample Output: TO-DO
apksigner sign --ks my-release-key.jks --ks-pass pass:'<PASSWORD>' --out <APP>_final.apk <APP>_repacked.apk
Sample Output: TO-DO

Dynamic Debugging

1. Set up

+--------------------------------------------------------------------+ | 1. Open genymotion and boot up Galaxy S9 (Random Pick) | | 2. Open IntelliJ Idea IDE | | 3. Open -> app (The folder just unpacked using apktool) | | 4. Run -> Edit Config -> JVM Remote Debug -> OK | | 5. File -> Project Structure -> Project -> SDK -> OpenSDK 20 -> OK | +--------------------------------------------------------------------+
Sample Output: TO-DO

2. Connect

./adb kill-server
Sample Output: TO-DO
./adb connect 127.0.0.1:6555
Sample Output: TO-DO
./adb -s 127.0.0.1:6555 install <FILE>
Sample Output: TO-DO

3. Run the app

+-------------------------+ | Run the app in emulator | +-------------------------+
Sample Output: TO-DO

4. Get PID and forward to Debugger

./adb -s 127.0.0.1:6555 shell ps -A | grep <REVERSE_DOMAIN_NAME_NOTATION>
Sample Output: TO-DO
./adb -s 127.0.0.1:6555 forward tcp:5005 jdwp:<PID>
Sample Output: TO-DO

5. StartDebugging

+-------------------------------------------+ | Click the debug icon in IntelliJ Idea IDE | +-------------------------------------------+
Sample Output: TO-DO