Useful commands

All the following commands are integrated in HacknDroid.

ADB shell

On a specific device ID:

The option -s <device_serial_number> can be added to every ADB command.

APK from AAB

App data

Retrieve app data (storage):

Reset app data

App Information

If the APK file was decompiled, look at AndroidManifest.xml.

Otherwise:

Backup

Create a backup

Description

Command

All the applications

adb backup -apk -f -shared -all <backup_name>.ab

Specific Application

adb backup -apk -f <backup_name>.ab <app_id>

The device will ask you to insert a <password> that you are going to use in the following command to create a TAR archive from the AB file.

The you can extract the TAR file as you want.

Restore a backup

Compile APK

The next step is the signing of the apk.

Connectivity & Battery

Option

Command

Airplane Mode ON

adb shell settings put global airplane_mode_on 1

Airplane Mode OFF

adb shell settings put global airplane_mode_on 0

Battery Status

adb shell dumpsys battery

Network information

adb shell dumpsys connectivity

Wifi OFF

adb shell svc wifi disable

Wifi ON

adb shell svc wifi enable

Wifi Settings

adb shell am start -a android.settings.WIFI_SETTINGS

CPU information

Decompile APK

Device information

Property
Description

ro.product.model

Device Model

ro.product.brand

Brand

ro.product.manufacturer

Manufacturer

ro.build.version.release

Android Version

ro.build.id

Build ID

ro.build.version.sdk

SDK Version

ro.build.date

Build Date

ro.serialno

Device Serial Number

External storage

File transfer

From mobile device to PC:

From PC to mobile device:

Install/Uninstall application

Uninstall an application from the mobile device:

Install from the APK file path:

Open the Play Store page of a specific application:

Example:

Keystore creation

Launch an application

Example:

List applications on the mobile device

Description

Command

All the applications

adb shell pm list packages

Running applications

adb shell "ps -A | awk '{print $9}'"

System applications

adb shell pm list packages -s

3rd-party applications

adb shell pm list packages -3

Logs

Retrieve the PID of the application

Action
Command

Default logs

adb logcat --pid=<pid>

Crash logs

adb logcat --pid=<pid> *:E

Memory dump

Merge APK

Mirroring

On default command port (27183)

If errors on binding like the following Open

  • mirror on a different port:

  • or restart Host Network Service (HNS) if on Windows and then run scrcpy:

Owner UID of the application

Package name from the Owner UID of the application

RAM information

Reboot/Shutdown

Action
Command

Reboot the device

adb reboot

Reboot the device into bootloader/fastboot mode

adb reboot bootloader

Reboot the device into recovery mode

adb reboot recovery

Shutdown the device

adb shell reboot -p

Screen recording

Screenshot

Sign APK

Stop an application

Storage info

Verify APK signature

Last updated