A production-grade command-line tool for managing wireless ADB connections with enhanced security features. Built for developers who want safer, more convenient wireless debugging.
Traditional wireless ADB (adb tcpip 5555) has several security issues:
- Fixed port (5555) makes devices easy targets for port scanners
- No automatic cleanup - connections persist after you're done
- Manual IP/port management is tedious and error-prone
- No security warnings about network risks
WirelessADB solves these problems:
- β Random high ports (30000-50000) for each session
- β Automatic connection management and cleanup
- β Network security warnings and subnet detection
- β Connection profiles and easy reconnection
- β Multi-device support with selection menu
- β Cross-platform (Windows & Linux)
Instead of using the well-known port 5555, WirelessADB generates a random port in the range 30000-50000 for each connection:
Traditional: adb tcpip 5555 (predictable, scannable)
WirelessADB: Random port like 37482, 42193, 31847, etc.
Why this matters:
- Attackers commonly scan for port 5555 on networks
- Random ports significantly reduce exposure to automated attacks
- Even if someone scans your IP, they won't know which port to target
- Each session uses a different port
- Subnet checking: Warns if device and host are on different networks
- Security warnings: Clear notices about wireless ADB risks
- Auto-disconnect: Cleans up connections when you exit
- USB reset: Optionally switches device back to USB-only mode
- Connection logging: Tracks when/where devices were connected
- β Use only on trusted private networks (home, office VPN)
- β
Disconnect when done (
wireless-adb disconnect) - β Never use on public Wi-Fi (coffee shops, airports, etc.)
- β Consider using a USB cable for sensitive operations
- β
Monitor connected devices regularly (
wireless-adb status)
- Python 3.7+ (cross-platform)
- Android Debug Bridge (ADB) installed and in PATH
- Android device running Android 8.1+ with USB debugging enabled
- USB cable (for initial connection)
- Wi-Fi connection on both device and host
-
Download
wireless_adb.pyfrom this repository -
Install Python from python.org (ensure "Add to PATH" is checked)
-
Install ADB:
- Download Platform Tools
- Extract to
C:\platform-tools\ - Add to PATH:
setx PATH "%PATH%;C:\platform-tools"
-
Make it easily accessible:
# Create a batch wrapper (run as Administrator)
echo @python "%USERPROFILE%\wireless_adb.py" %* > C:\Windows\wireless-adb.bat- Test installation:
wireless-adb statusgit clone https://github.com/yourusername/wireless-adb.git
cd wireless-adb
python wireless_adb.py status# Install dependencies
sudo apt update
sudo apt install android-tools-adb python3 python3-pip
# Download the tool
wget https://raw.githubusercontent.com/yourusername/wireless-adb/main/wireless_adb.py
chmod +x wireless_adb.py
# Install system-wide
sudo mv wireless_adb.py /usr/local/bin/wireless-adb
sudo chmod +x /usr/local/bin/wireless-adb
# Test
wireless-adb status# Install to ~/.local/bin
mkdir -p ~/.local/bin
cp wireless_adb.py ~/.local/bin/wireless-adb
chmod +x ~/.local/bin/wireless-adb
# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$HOME/.local/bin:$PATH"
# Reload shell
source ~/.bashrc
# Test
wireless-adb statusgit clone https://github.com/yourusername/wireless-adb.git
cd wireless-adb
chmod +x wireless_adb.py
./wireless_adb.py status# Check Python version
python3 --version # Should be 3.7+
# Check ADB
adb version # Should show ADB version
# Check WirelessADB
wireless-adb status# 1. Connect device via USB and enable USB debugging
# 2. Connect wirelessly (generates random port automatically)
wireless-adb connect
# 3. Unplug USB cable and continue working
# 4. When done, clean up
wireless-adb disconnectDetects USB device, generates random port, and establishes wireless connection.
wireless-adb connect
# Verbose mode (shows all ADB commands)
wireless-adb connect -v
# Quiet mode (minimal output)
wireless-adb connect -qExample Output:
============================================================
WirelessADB - Secure Wireless ADB Connection Manager
============================================================
[1/5] Detecting USB-connected Android devices...
[OK] Selected: Pixel 6 Pro (1A2B3C4D5E6F)
[2/5] Retrieving device Wi-Fi IP address...
[OK] Device IP: 192.168.1.145
[3/5] Generating secure random port...
[OK] Using port: 37482
[4/5] Switching device to TCP/IP mode...
[OK] TCP/IP mode enabled on port 37482
[5/5] Connecting to device wirelessly...
[OK] Connected wirelessly to 192.168.1.145:37482
[SECURITY] Wireless ADB is INSECURE on untrusted networks!
β’ Anyone on the network can access your device
β’ Use only on trusted private networks
β’ Random ports reduce (but don't eliminate) risk
============================================================
β CONNECTED SUCCESSFULLY
============================================================
Device: Pixel 6 Pro
Target: 192.168.1.145:37482
You can now disconnect the USB cable.
Run 'wireless-adb disconnect' to cleanup when done.
Disconnects all wireless connections and optionally resets devices to USB mode.
wireless-adb disconnect
# Disconnect but don't reset to USB mode
wireless-adb disconnect --no-resetShows all connected devices (USB and wireless) and saved profiles.
wireless-adb statusExample Output:
============================================================
WirelessADB - Connection Status
============================================================
USB Devices (1):
β’ 1A2B3C4D5E6F device product:raven model:Pixel_6_Pro device:raven
Wireless Devices (1):
β’ 192.168.1.145:37482 device product:raven model:Pixel_6_Pro device:raven
Saved Profiles (2):
β’ Pixel 6 Pro (1A2B3C4D5E6F)
Last: 192.168.1.145:37482 @ 2026-02-16 14:32:15
β’ Galaxy S21 (9Z8Y7X6W5V4U)
Last: 192.168.1.158:42193 @ 2026-02-15 18:45:22
Reconnects to the last successfully connected device.
wireless-adb reconnectUseful when:
- Your device disconnected temporarily
- You restarted your computer
- Network connection was interrupted
If multiple USB devices are connected, you'll get a selection menu:
wireless-adb connect
[FOUND] 2 devices connected:
[1] Pixel 6 Pro (1A2B3C4D5E6F)
[2] Galaxy S21 (9Z8Y7X6W5V4U)
Select device [1-2]: 1See all ADB commands and output:
wireless-adb connect -v
[DEBUG] Running: adb version
[DEBUG] Output: Android Debug Bridge version 1.0.41
[DEBUG] Running: adb devices
[DEBUG] Running: adb -s 1A2B3C4D5E6F shell ip addr show wlan0
...If colors don't display properly:
wireless-adb connect --no-colorWirelessADB stores connection profiles in:
- Windows:
C:\Users\YourName\.wireless_adb\profiles.json - Linux:
~/.wireless_adb/profiles.json
{
"1A2B3C4D5E6F": {
"ip": "192.168.1.145",
"port": 37482,
"last_connected": 1708099935.123456,
"device_name": "Pixel 6 Pro"
}
}You can manually edit this file if needed, but it's automatically managed by the tool.
Windows:
# Download Platform Tools from Android website
# Extract to C:\platform-tools\
# Add to PATH:
setx PATH "%PATH%;C:\platform-tools"
# Restart terminal
adb versionLinux:
sudo apt install android-tools-adb
# or
sudo pacman -S android-tools-
Enable USB Debugging:
- Settings β About Phone β Tap "Build Number" 7 times
- Settings β Developer Options β Enable "USB Debugging"
-
Authorize Computer:
- Unlock device
- Allow USB debugging popup
-
Check USB Connection:
adb devices
Should show your device, not "unauthorized"
-
Try Different Cable/Port:
- Some cables are charge-only
- Try different USB ports
-
Ensure Wi-Fi is Connected:
- Device must be on Wi-Fi (not just mobile data)
- Pull down notification shade β verify Wi-Fi icon
-
Check Wi-Fi Interface: Some devices use different interface names:
adb shell ip addr
Look for your IP address
-
Same Network:
- Device and computer must be on same Wi-Fi network
- Corporate networks may block device-to-device communication
-
Firewall:
- Windows: Allow Python through Windows Defender Firewall
- Linux: Check
iptablesorufwrules
sudo ufw allow from 192.168.1.0/24
-
Router Settings:
- Disable "AP Isolation" / "Client Isolation"
- Enable local network communication
-
Retry Connection:
wireless-adb disconnect wireless-adb connect -v
- Increase timeout in code (line 70,
timeout=30) - Check network speed/stability
- Device may be overloaded
Extremely rare (1 in 20,000 chance), but if port is in use:
# Just reconnect - new random port will be generated
wireless-adb connect# List all devices manually
adb devices -l
# Kill and restart ADB server
adb kill-server
adb start-serverwireless_adb.py
βββ Colors # Terminal color codes
βββ LogLevel # Verbosity levels
βββ DeviceProfile # Device connection data
βββ ADBWrapper # Low-level ADB command wrapper
β βββ _verify_adb()
β βββ run_command()
β βββ get_devices()
β βββ get_device_ip()
β βββ enable_tcpip()
β βββ connect_wireless()
β βββ disconnect()
β βββ usb_mode()
βββ WirelessADBManager # High-level connection manager
β βββ connect()
β βββ disconnect()
β βββ status()
β βββ reconnect()
β βββ _generate_random_port()
β βββ _check_network_security()
β βββ _save_profile()
β βββ _load_profile()
βββ main() # CLI entry point
-
Separation of Concerns:
ADBWrapper: Raw ADB command executionWirelessADBManager: Business logic and user interactionmain(): CLI argument parsing
-
Error Handling:
- Try/catch blocks around all ADB operations
- Graceful degradation (network check is best-effort)
- Clear error messages with actionable solutions
-
Cross-Platform:
- Pure Python 3.7+ (no platform-specific dependencies)
- Color disable for Windows CMD
- IP detection works on both Windows and Linux
-
Testability:
- Modular functions
- Dependency injection (ADBWrapper passed to Manager)
- Verbose mode for debugging
Traditional Approach (Port 5555):
# Attacker's script
for ip in network_scan("192.168.1.0/24"):
if port_open(ip, 5555):
connect_adb(ip, 5555) # Easy target!WirelessADB Approach (Random Ports):
# Attacker must scan ALL high ports (30000-50000)
for ip in network_scan("192.168.1.0/24"):
for port in range(30000, 50000): # 20,000 ports!
if port_open(ip, port):
connect_adb(ip, port) # Takes hours, device may disconnectAttack Surface Reduction:
- Port 5555: 1 predictable target
- Random port: 1 in 20,000 chance per attempt
- Even with port scanning tools, takes significant time
- User likely disconnects before scan completes
Protects Against:
- β Automated port 5555 scanners
- β Opportunistic attacks on public networks
- β Accidental persistent connections
Does NOT Protect Against:
- β Determined attacker on your network (they can scan all ports)
- β ARP spoofing / MITM attacks
- β Compromised router
- β Malicious apps on the device itself
# β
Good: Trusted home network
wireless-adb connect
# Work on project
wireless-adb disconnect
# β Bad: Coffee shop Wi-Fi
wireless-adb connect # DON'T DO THIS
# β
Good: Use VPN for untrusted networks
sudo openvpn ~/my-vpn.ovpn
wireless-adb connect # Now both on VPNFor extra security, you can:
-
Firewall Rules:
# Linux: Only allow ADB from specific IP sudo ufw allow from 192.168.1.145 to any port 30000:50000 # Windows: Create inbound rule for Python.exe
-
Port Knocking: Modify code to require a "knock sequence" before connecting
-
Certificate-Based Auth: ADB supports RSA key authentication (requires device modification)
-
Network Isolation: Use a dedicated IoT/dev network for Android devices
Edit wireless_adb.py:
class WirelessADBManager:
PORT_MIN = 40000 # Change this
PORT_MAX = 45000 # And thisAdd to your crontab (Linux):
*/5 * * * * /usr/local/bin/wireless-adb reconnect --quiet# Use in scripts
wireless-adb connect -q && flutter run
# Check status before deploying
wireless-adb status | grep "Wireless Devices: None" && wireless-adb connectThe tool automatically saves profiles for all devices you connect to:
wireless-adb status # Shows all saved profilesFound a bug? Have a feature request? Contributions welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
git clone https://github.com/yourusername/wireless-adb.git
cd wireless-adb
# Install in development mode
pip install -e .
# Run tests (if implemented)
python -m pytest tests/MIT License - see LICENSE file for details
- Android Debug Bridge (ADB) team at Google
- The Android developer community
- Built with security and convenience in mind
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Report vulnerabilities privately via email
Happy (Safe) Wireless Debugging! ππ