The AndroidForensics project is a practical guide and toolkit for extracting digital artifacts from Android devices using ADB (Android Debug Bridge) commands. Whether youβre an investigator, researcher, or security enthusiast, this repo walks you through the process of gathering system and app-level data safely, transparently, and reproducibly, using a non-rooted device running Android.
Before you begin, ensure you have:
- ADB installed on your system:
sudo apt install adb -y
- USB debugging enabled on the target Android device.
- Proper authorization (legal and ethical) to access and analyze the device.
Ensure your device is connected and recognized:
adb devicesExample output:
List of devices attached
RZ8N1234XYZ device
Pull general information about the device and system state:
adb shell getpropOr, for specific properties:
adb shell getprop ro.product.model
adb shell getprop ro.build.version.release
adb shell getprop ro.serialnoThis gives insight into the model, OS version, and serial number β essential for report documentation.
List all installed apps and their installation paths:
adb shell pm list packages -fTo export this list for analysis:
adb shell pm list packages -f > installed_apps.txtGrab real-time logs from the device:
adb logcat -d > system_logs.txtThis file can contain crash traces, app activity, network events, and more β valuable for timeline reconstruction.
Gather device power metrics:
adb shell dumpsys batteryExample output:
AC powered: false
USB powered: true
level: 84
temperature: 290
Collect network configuration and connection details:
adb shell dumpsys connectivity
adb shell ifconfig
adb shell netstatForensic acquisition of accessible directories:
adb pull /sdcard/DCIM ./Android_Images
adb pull /sdcard/Download ./Downloads
adb pull /data/system/packages.list ./Package_List
β οΈ Note: Access to/datadirectories may require root or forensic-mode images.
Gather system usage and history:
adb shell dumpsys usagestats
adb shell dumpsys batterystats
adb shell settings list systemThis helps reconstruct user behavior and system-level changes over time.
Excellent β youβre now documenting the user-data extraction portion of your ADB forensic workflow. Letβs make this section polished, consistent with the rest of your README, and include short explanations, file-saving commands, and modern syntax notes.
Hereβs a ready-to-paste Markdown section you can add under your βDevice Timeline and Activity Dataβ block:
These commands use Androidβs content providers and system services to enumerate user accounts and communication data available via ADB. Results are saved locally for later review.
β οΈ On Android 11 and higher, access to contacts, call logs, and SMS viaadb shell contentmay be restricted unless the device is rooted or a special forensic build is used.
adb shell dumpsys account|grep -i com.*$ -o|cut -d' ' -f1|cut -d} -f1|grep -v com$Lists all app package names that have registered accounts on the device.
adb shell dumpsys | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"Extracts every detected email address from the Account Manager service.
adb shell settings list global|grep "boot_count="|cut -d= -f2|head -n 1|xargs echo "Booted:"|sed 's/$/ times/g'Retrieves the device boot counter from global system settings.
adb shell content query --uri content://contacts/phones/ --projection display_name:number | cut -f 3- -d " "Shows all stored contact names and phone numbers.
adb shell content query --uri content://contacts/phones/ Lists raw contact provider data for quick inspection.
adb shell content query --uri content://call_log/calls Retrieves call history entries including number, type, and timestamp.
adb shell content query --uri content://sms/ Exports SMS database contents such as address, date, and body.
Output β sms.txt
- Always document the Android version and collection timestamp alongside the exported files.
- Data volume can be large; redirect outputs to files as shown to preserve formatting.
- On newer Android releases, you may need root, developer-build access, or special forensic images for complete results.
This repo includes two Bash utilities to automate and standardize your data extraction workflow:
π± Click to Expand
Excellent β this is a much more advanced version of your earlier ADB script. It not only gathers system diagnostics but also extracts user-level data (contacts, call logs, SMS, accounts). Letβs go through what it does in detail and then pick a fitting name.
This Bash script performs an automated ADB-based forensic data and diagnostics extraction from a connected Android device. Itβs designed for system analysis, auditing, or incident response β collecting both system snapshots and select user-accessible data in a single organized run.
- Checks that
adb(Android Debug Bridge) is installed. - Starts the ADB server silently.
- Detects a connected Android device (
adb devices). - Exits if no authorized device is found.
- Displays the connected device ID.
Example:
ADB_Report_20251025_163200/
All collected data is stored here, one file per command.
A helper that:
- Displays a colorized header describing the task.
- Runs the given ADB command.
- Saves output to a specified filename.
- Optionally runs βsilentβ tasks (no console output, for noisy commands).
| Category | Description | Command |
|---|---|---|
| Basic Info | Model, manufacturer, Android version, serial | getprop ... |
| Device State | Uptime, battery, and connectivity | uptime, dumpsys battery, dumpsys connectivity |
| Network Info | Interface config | ifconfig or ip addr show |
| Data | Description | Command |
|---|---|---|
| Accounts | Extracts account package names | dumpsys account |
| Email addresses | Extracts email strings via regex | dumpsys account |
| Reboot count | Reads global boot counter | settings list global |
| Contacts | Lists contacts and phone numbers | content query --uri content://contacts/phones/ |
| Call logs | Queries system call history | content query --uri content://call_log/calls |
| SMS messages | Dumps all SMS database entries | content query --uri content://sms/ |
| Installed packages | Lists all and third-party apps | pm list packages |
| Running services | Dumps currently active services | dumpsys -l |
β οΈ These use Androidβs public content providers, meaning some data may not be available on modern devices (Android 11+ restricts SMS, contacts, etc. access via ADB unless rooted or with specific permissions).
logcatsnapshot: Captures last ~1000 lines of logs.bugreport: Generates a full system report in the background (.zipor.txt), allowing the user to continue using the script while it completes.
- Prints a color-coded summary table showing all collected files and their sizes.
- Displays total runtime (excluding background bugreport).
- Reminds the user that the bugreport will appear when finished.
Example:
[β] All ADB data extraction commands executed successfully!
Summary of extracted files:
device_info.txt 4.2K
emails.txt 1.1K
contacts.txt 32K
sms.txt 80K
-------------------------------------------
Results saved in: ADB_Report_20251025_163200
Total runtime: 42s
[i] Bugreport is running in the background...
This script is suitable for:
- Incident response or forensic triage
- Device auditing before handoff
- Support or QA data collection
- Security analysis / compliance snapshots
It collects:
- System state
- Network and battery info
- App lists
- User-level communications data (where permitted)
- Logs and bugreport
- Access to SMS, call logs, and contacts may be blocked on newer Android versions (especially Android 11+).
- Should only be used on devices you own or have explicit consent to examine.
- Data collected may contain personally identifiable information β handle securely.
π± Click to Expand
This Bash script is an automated Android diagnostics collector.
It connects to an Android device over ADB (Android Debug Bridge) and runs a series of dumpsys commands β each targeting a key Android system service β then saves their outputs into organized text files.
Hereβs what happens step by step:
- Checks that the
adbtool is installed and accessible in your systemPATH. - Starts the ADB server if itβs not already running.
- Waits up to 30 seconds (10 retries Γ 3s) for an Android device to be connected and authorized.
- Accepts an optional device serial as an argument (useful if multiple devices are connected).
Creates an output folder such as:
DumpSysReport_20251025_153000/
All command outputs are saved in this directory, each to its own .txt file.
It loops through a predefined list of 21 dumpsys services, including:
| Command | Purpose |
|---|---|
dumpsys meminfo |
Memory usage |
dumpsys media.audio_flinger |
Audio playback internals |
dumpsys sensorservice |
Sensor (motion/environment) data |
dumpsys adb |
ADB subsystem info |
dumpsys account |
Accounts and sync services |
dumpsys fingerprint |
Fingerprint authentication info |
dumpsys netstats |
Network usage statistics |
dumpsys power |
Power manager and wake locks |
dumpsys location |
GPS and location services |
dumpsys notification |
Notification history |
dumpsys telecom |
Telephony/call data |
dumpsys wifi |
Wi-Fi state/history |
| ...and more |
Each commandβs output is:
- Displayed live in the terminal (
tee) - Saved to a corresponding file (e.g.,
wifi.txt,meminfo.txt)
If a command fails, itβs logged as failed β otherwise marked as succeeded.
At the end, it prints a color-coded summary:
Succeeded Commands: 20
β dumpsys meminfo
β dumpsys wifi
...
Failed Commands: 1
β dumpsys clipboard
All outputs saved in DumpSysReport_20251025_153000
This script is ideal for:
- Developers gathering system state for debugging.
- QA engineers doing regression tests or bug triage.
- Forensic analysts collecting non-user diagnostic data.
- Tech support capturing structured device reports.
Itβs non-invasive β it does not pull user files (photos, downloads, etc.) β only system service states available via ADB.
-
Clone the repo:
git clone https://github.com/DouglasFreshHabian/AndroidForensics.git cd AndroidForensics -
Make the scripts executable:
chmod +x extract.sh dumpsys.sh
-
Run the
extract.shscript:./extract.sh
-
Run the
dumpsys.shscript:./dumpsys.sh
AndroidForensics/
βββ extract.sh
βββ dumpsys.sh
βββ Assets/
β βββ Droid-Detective.png
βββ outputs/
β βββ ADB_Report_20251025_005650/
β βββ DumpSysReport_20251024_171220/
βββ README.md
This toolkit is for authorized forensic analysis only. Ensure compliance with local laws and privacy regulations. Unauthorized data extraction may violate legal boundaries.
If you have ideas, want to add new ADB command modules, or improve automation β open an issue or submit a pull request! Letβs build an open, transparent, and responsible forensic community.
If AndroidForensicsβ’ helps your investigations, consider supporting continued development:

