-
Notifications
You must be signed in to change notification settings - Fork 0
Android
Nicolas Christin edited this page Sep 7, 2022
·
9 revisions
Add OWASP ZAP root certificate to emulated device (API < 29 required):
$ openssl x509 -inform PEM -subject_hash_old -in owasp_zap_root_ca.pem | head -1
9e86394f
$ ln -s owasp_zap_root_ca.pem 9e86394f.0
$ ~/Android/Sdk/emulator/emulator -avd S9_API_28 -writable-system
$ adb root
$ adb remount
$ adb push 9e86394f.0 /system/etc/security/cacerts
$ adb shell "chmod 644 /system/etc/security/cacerts/9e86394f.0"
$ adb reboot
Extract APK from phone:
$ adb shell pm list packages
$ adb shell pm path <package>
$ adb pull <path>
Decompile/recompile APK:
$ apktool d -r -o patched com.example.apk
$ apktool b -o com.example.patched.apk patched
$ # Some packages require aapt v2:
$ apktool b --use-aapt2 -o com.example.patched.apk patched
$ keytool -genkey -v -keystore my-release-key.keystore -alias acut3 -keyalg RSA -keysize 2048 -validity 10000
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.example.patched.apk acut3
$ # Or Google's signer can be used to replace a signature:
$ ~/Android/Sdk/build-tools/30.0.0/apksigner sign -ks my-release-key.keystore com.example.patched.apk
Install APK on emulated device:
$ adb install <file.apk>