ADB and Android Tooling¶
ADB is your gateway to Android internals
Without it you're limited to what the UI shows you and that's almost nothing useful for security testing. ADB provides shell access , app management , log streaming , file transfer , and debugging capabilities
Connection Methods
# USB connection
adb usb
# TCP/IP connection (remote device)
adb connect 192.168.1.100:5555
# Wireless debugging (Android 11+)
adb pair 192.168.1.100:41321
Shell Access
adb shell # Interactive shell
adb shell "command arg" # Run one command
adb shell "run-as package.name" # Run as specific app
adb shell -t # Force PTY allocation
App Management
adb install -r app.apk # Install (reinstall if exists)
adb install -t app.apk # Install test APK
adb uninstall package.name # Remove app
adb shell pm list packages # List all packages
adb shell pm list packages -3 # List third-party apps
adb shell pm path package.name # APK file path
# Extract APK from device
adb shell pm path com.target.app
adb pull /data/app/.../base.apk target.apk
Data Extraction
adb pull /sdcard/ # Pull entire sdcard
adb pull /data/data/package.name/ # App private data (requires root)
adb backup -f backup.ab package.name # Full backup
adb restore backup.ab # Restore backup
Logcat
adb logcat # Stream all logs
adb logcat -c # Clear logs
adb logcat -s "TAG" # Filter by tag
adb logcat -d > logs.txt # Dump to file
adb logcat *:E # Show only errors
adb logcat | grep "password\|token\|secret" # Credential hunting
Activity Manager
# Start specific activity
adb shell am start -n package.name/.ActivityName
# Start with extras
adb shell am start -n package.name/.ActivityName --es "key" "value"
# Send broadcast
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
# Force stop
adb shell am force-stop package.name
Package Manager Deep Dive
# Get APK details
adb shell dumpsys package package.name
# List permissions granted to package
adb shell dumpsys package package.name | grep "granted=true"
# Check if debuggable
adb shell dumpsys package package.name | grep "flags"
# Check backup capability
adb shell dumpsys package package.name | grep "allowBackup"
Other Android Security Tools
# Settings
adb shell settings list global
adb shell settings list secure
adb shell settings list system
# Device policy
adb shell dumpsys device_policy
# Network
adb shell netstat -anp
adb shell ifconfig
adb shell ip addr show