adb
Android Debug Bridge - device management, shell access, app testing, and Frida integration.
Load with: use adb
What this module does
adb wraps the Android Debug Bridge for programmatic device control from ilusm.
You can enumerate connected devices, run shell commands (as regular user or root), push and pull files,
install and uninstall APKs, capture screenshots and screen recordings, read logcat, dump process memory,
launch Frida hooks, and bypass root detection or SSL pinning.
Requires adb to be on your PATH and USB debugging enabled on the target device. Root operations require a rooted device.
Quick example
use adb
# List connected devices
devices = adbde()
# Run a shell command on device "emulator-5554"
out = adbsh("emulator-5554", "whoami")
prn(out)
# Install an APK
adbin("emulator-5554", "/tmp/app.apk")
# Take a screenshot
adbcp("emulator-5554", "/sdcard/screen.png")
Functions
Device management
adbde()
Returns the list of connected ADB devices. Calls __adb_devices().
adbco(host, port)
Connects to an ADB device over TCP/IP at the given host and port.
adbdi()
Disconnects all ADB connections.
Shell access
adbsh(did, cmd)
Runs a shell command on the device with the given device ID. Returns the output as a string.
adbsr(did, cmd)
Runs a shell command as root (adb shell su -c). Requires a rooted device.
File operations
adbpl(did, rp, lp)
Pulls a file from the remote path rp on the device to local path lp.
adbps(did, lp, rp)
Pushes a file from local path lp to remote path rp on the device.
App management
adbpa(did)
Returns the list of installed packages on the device.
adbin(did, apk)
Installs an APK file onto the device.
adbun(did, pkg)
Uninstalls a package by package name.
adbcl(did, pkg)
Clears all data for a package by running pm clear {pkg} via shell.
adbdu(pp)
Copies the APK at path pp to ./base.apk using fs.cp.
Activity and service enumeration
adbac(did, pkg)
Returns a list of activities for a package by running dumpsys package {pkg} | grep Activity and splitting on newlines.
adbse(did)
Returns a list of running services by running service list and splitting on newlines.
Intents
adbit(did, action, uri)
Fires an Android intent with the given action and URI. Calls __adb_intent.
adbdr(did, lnk)
Opens a file URI using am start -a android.intent.action.VIEW -d file://{lnk}.
Backup and restore
adbba(did, pkg, out)
Creates an ADB backup of a package to the output path.
Screenshot and screen recording
adbcp(did, out)
Takes a screenshot on the device and saves it to the given output path.
adbrec(did, dur, out)
Records the screen for dur seconds and saves to out.
Logcat
adblo(did, flt)
Reads logcat output, filtered by the given filter string.
adblc(did)
Clears the logcat buffer by running logcat -c.
Memory dump
adbme(did, pid, out)
Dumps process memory by reading /proc/{pid}/mem as root and writing to out. Requires root.
Frida integration
adbfs(did)
Starts the Frida server on the device by running /data/local/tmp/frida-server & as root.
adbfp(did)
Lists processes visible to Frida on the device.
adbfh(did, proc, script)
Attaches a Frida hook script to a process by name on the device.
Debug and security detection
adbis(did, pkg)
Returns tru if the package has the DEBUGGABLE flag set, by grepping the dumpsys flags output.
adbhi(did)
Attempts to hide root by remounting /system read-write and removing su binaries. Requires root.
adbss(did, pkg)
Injects a Frida script to bypass SSL pinning by overriding X509TrustManager. Requires Frida server running on device.