ADB 101
Fri, Oct 7, 2022
Small collection of useful adb commands for analyzing apks.
# get shell on android device
xappa ~ $ adb shell
htc_himauhl:/ $ whoami
shell
# get root on rooted android
xappa ~ $ adb shell
htc_himauhl:/ $ su
htc_himauhl:/ # whoami
root
# copy files to device
adb push <file> <destination>
# copy files from device
$ adb pull /mnt/sdcard/base.apk
/mnt/sdcard/base.apk: 1 file pulled, 0 skipped. 12.6 MB/s (6128796 bytes in 0.462s)
# if you get adb: error: remote object '<file>' does not exist
# copy the file via adb shell to sdcard and rerun adb pull
# get list of installed packages with full path
$ adb shell pm list packages -f
package:/system/app/Skype_Stub/Skype_Stub.apk=com.skype.raider
package:/system/app/HtcCompressViewer/HtcCompressViewer.apk=com.htc.htccompressviewer
...
# un/install apks
$ adb install base.apk
$ adb uninstall base.apk