Skip to content
Inventor365Public

About

Ability connect adb device over ssh servers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ADBridge — Universal Android ADB over SSH Tunnel Studio

Bridge any locally connected Android device (USB, Wi-Fi, Recovery, Sideload, or Emulator) to any remote SSH server with zero configuration on the remote host.


Overview

ADBridge is a cross-platform desktop and CLI application (with native Windows support) that creates a smart, persistent SSH reverse tunnel between your local computer's Android Debug Bridge (adb) server and any remote SSH server (cloud VPS, remote build server, CI runner, or container).

Once connected, any terminal, build script, or IDE on the remote SSH server can execute adb devices, adb shell, adb logcat, adb push, adb pull, adb install, and more—as if your phone were physically plugged into the remote server via USB.

┌─────────────────────────┐       USB / Wi-Fi       ┌──────────────────────────────┐
│   Android Phone / Dev   │ ◄─────────────────────► │   Local PC (ADBridge Host)   │
│ (USB, Wi-Fi, Recovery)  │                         │   Local ADB Server (:5037)   │
└─────────────────────────┘                         └──────────────┬───────────────┘
                                                                   │
                                                       Encrypted SSH Reverse Tunnel
                                                      (Smart ADB Socket Proxy + TCP_NODELAY)
                                                                   │
                                                                   ▼
                                                    ┌──────────────────────────────┐
                                                    │      Remote SSH Server       │
                                                    │  127.0.0.1:5037 & [::1]:5037 │
                                                    │  $ adb devices / adb shell   │
                                                    └──────────────────────────────┘

Key Features

  • 1-Click Setup & Auto-Dependency Installer:
    • Automatically detects missing Python packages (PySide6, paramiko, segno) and installs them via pip (inside a private .venv on Linux/macOS).
    • Automatically detects if local adb (Android SDK Platform-Tools) is missing on your PC and downloads/extracts the official Google Android SDK Platform-Tools into ~/.adbridge/platform-tools/ in one click.
    • Automatically detects if the remote SSH server is missing adb and installs official Linux Platform-Tools into ~/.adbridge/platform-tools/adb on the remote host (no root/sudo required).
  • Wireless Debugging Built In (Android 11+):
    • Nearby devices are discovered automatically over mDNS and connect with one click.
    • QR-code pairing: scan the code ADBridge shows from Developer options › Wireless debugging — it pairs and connects on its own.
    • Pairing-code pairing, manual IP:port connect with history, Switch to Wi-Fi for USB phones, and a LAN scan for legacy port-5555 devices.
  • Universal Android Device Compatibility:
    • All Connection Modes: USB 2.0/3.0, Wireless ADB (IP:Port), Android 11+ Wireless Debugging Pairing (6-digit pairing code), TCP/IP 5555 mode, Android Studio Emulators, WSA, and Waydroid.
    • All Device States: Standard booted Android (device), Custom Recoveries like TWRP/OrangeFox/Lineage Recovery (recovery), sideload, and automatic alerts for unauthorized (RSA prompt) or offline states.
    • Cross-Version ADB Protocol Bridging: Automatically translates host:version handshakes so remote and local adb binaries never clash with adb server version (X) doesn't match this client (Y); killing....
    • Multi-Device Serial Locking: Lock the tunnel to a single chosen device when multiple phones or emulators are plugged into your PC.
  • Smart SSH Tunnel Engine:
    • Binds both IPv4 (127.0.0.1:5037) and IPv6 ([::1]:5037) on the remote server with TCP_NODELAY for low-latency command execution.
    • Intercepts and blocks accidental remote adb kill-server commands so remote scripts cannot kill your local PC's ADB daemon.
    • Automatic port fallback (15037) on shared multi-user servers if port 5037 is occupied by another user.
    • Built-in SSH keepalive and automatic reconnection if your network drops.
  • Built-in Remote ADB Terminal & File Transfer:
    • Execute adb or Linux shell commands directly on the remote SSH server from the GUI.
    • One-click diagnostic actions (adb devices -l, Device Props, Kernel uname -a, Battery & Thermal, Storage df -h, Top CPU, Logcat).
    • Direct Remote Server <-> Phone file push/pull (adb push / adb pull) over the tunnel.
  • Clean Sidebar UI: Overview · Devices · Wireless · Server · Terminal · Activity, dark theme, system-tray mode, cross-platform fonts.
  • Configurable Server Profiles & Quick SSH String Parser:
    • Paste any SSH command string (e.g., ssh user@your-server.com -p 2222) to automatically populate Host, Port, and Username.
    • Save, switch, and manage multiple server profiles. All credentials are stored locally in ~/.adbridge/config.json (never inside the git repository).

1-Click Setup Commands

Supported desktops: Windows 10/11, macOS 11+ (Intel & Apple Silicon) and Linux (X11 or Wayland: Ubuntu/Debian, Fedora, Arch, …). Requirements: Python 3.9+ and git. Everything else (Python packages, Google's adb) is installed for you.

Windows (PowerShell)

Clones ADBridge, installs dependencies (including Python via winget and adb if missing), builds the native ADBridge.exe launcher, creates a Desktop shortcut and launches the app:

git clone https://github.com/Inventor365/ADBridge.git "$HOME\ADBridge"; Set-Location "$HOME\ADBridge"; powershell -ExecutionPolicy Bypass -File .\setup.ps1

Already cloned? Double-click setup.bat once, then start it any time with ADBridge.exe, the Desktop shortcut, or Launch-ADBTunnel.bat.

Linux & macOS

git clone https://github.com/Inventor365/ADBridge.git ~/ADBridge && cd ~/ADBridge && bash setup.sh

setup.sh creates a private virtual environment in ~/ADBridge/.venv (so it works on "externally managed" system Pythons such as Ubuntu 23.04+, Fedora, Arch and Homebrew), installs the packages, downloads adb if needed and launches the app. Afterwards start it with:

~/ADBridge/launch.sh
Linux notes
  • Qt needs libxcb-cursor0 (setup warns if missing): sudo apt install libxcb-cursor0 · sudo dnf install xcb-util-cursor · sudo pacman -S xcb-util-cursor.
  • python3-venv on Debian/Ubuntu: sudo apt install python3-venv.
  • USB permissions: if a phone shows as no permissions, install Android udev rules (sudo apt install android-sdk-platform-tools-common, Fedora android-tools, Arch android-udev) and replug.
  • Wireless discovery needs mDNS (UDP 5353) allowed by your firewall.
macOS notes
  • Install Python from python.org or brew install python.
  • If the QR scan / nearby devices aren't detected, allow incoming connections for adb in System Settings › Network › Firewall.
  • Open SSH terminal opens a new Terminal.app window.

Remote SSH server

Any Linux server you can SSH into (password or key). Nothing needs to be installed beforehand: ADBridge installs Google's adb into ~/.adbridge/platform-tools on first connect (x86_64, needs python3, no sudo). On ARM servers (e.g. Raspberry Pi, Graviton, Ampere) install the distro package instead: sudo apt install adb / sudo dnf install android-tools.


Dependency Check & Auto-Installer

ADBridge checks your environment on startup and clearly informs you if any package or binary is missing.

  • In the GUI: Click System check at the bottom of the sidebar at any time to view the full system health report or click Install / update ADB.
  • From the Command Line:
    # Check installed dependencies & report missing items
    python main.py --check-deps          # Linux/macOS: .venv/bin/python main.py --check-deps
    
    # Automatically install all missing Python packages & download official Google ADB Platform-Tools
    python main.py --install-deps
Component Purpose Auto-Installed by ADBridge?
Python 3.9+ Core runtime Auto-installed via winget in setup.ps1 if missing on Windows
paramiko SSH2 client & reverse port forwarding engine Yes (pip auto-bootstrap)
PySide6 Native Qt6 dark-mode desktop GUI Yes (pip auto-bootstrap)
segno QR code for Wireless Debugging pairing Yes (pip auto-bootstrap)
Local adb Communicates with local USB/Wi-Fi Android devices Yes (downloads official Google Platform-Tools to ~/.adbridge/platform-tools)
Remote adb Executes ADB commands on the remote SSH server Yes (auto-installs Linux Platform-Tools to ~/.adbridge/platform-tools on remote server without sudo)

Usage Guide

On Linux/macOS, python main.py … below means ./launch.sh … (or .venv/bin/python main.py …) so the private virtual environment is used.

1. Desktop GUI Mode (Default)

python main.py

The window has a sidebar with six pages:

Page What it's for
Overview Device → PC → Server status at a glance, Start/Stop tunnel, live traffic stats, and the exact command to run on the server.
Devices Every device the local adb server sees (USB, Wi-Fi, emulator, recovery) with model, Android version and battery. Pick the tunnel device, Switch to Wi-Fi a USB phone, or disconnect a wireless one.
Wireless Android 11+ Wireless Debugging: auto-discovered nearby devices (mDNS) with one-click Connect/Pair, QR-code pairing, pairing-code pairing, manual IP:port connect with history, and a LAN scan for legacy port-5555 devices.
Server SSH profiles (new / rename / delete), paste-an-ssh-command quick fill, key or password auth, ports and tunnel options.
Terminal Run adb on the server through the tunnel, shell commands on the server, or adb locally; quick-command menu and server ↔ phone push/pull.
Activity Colour-coded tunnel log with filters (hide adb traffic / warnings only).

Typical flow:

  1. Server → fill in host/user (or paste ssh user@host -p 22) → Save.
  2. Connect a phone: USB with USB debugging on, or Wireless → on the phone open Developer options › Wireless debugging › Pair device with QR code and scan the code shown by ADBridge. It pairs and connects automatically. Next time the phone shows up under Nearby devices with a Connect button.
  3. Press Start tunnel. On the server, run adb devices -l (Overview shows the exact command, including ADB_SERVER_SOCKET when a non-default port is used).

Wireless discovery uses adb's built-in mDNS. If nearby devices or the QR scan aren't detected, allow adb.exe through Windows Firewall on private networks, make sure PC and phone share the same Wi-Fi, or use the pairing-code tab.


2. Headless CLI Mode

You can also run ADBridge on headless machines or in scripts:

# Start tunnel using your saved default server profile
python main.py --cli

# Start tunnel with explicit SSH string and password
python main.py --cli --ssh "ssh user@your-server.com -p 22" --password "your_password"

# Launch GUI and immediately connect on startup
python main.py --auto-connect

Project Structure

ADBridge/
├── main.py                  # Application entry point (GUI, CLI, & dependency bootstrapper)
├── gui.py                   # PySide6 sidebar GUI: overview, devices, wireless pairing, server, terminal, activity
├── tunnel_engine.py         # LocalAdbManager (USB/Wi-Fi/mDNS) & AdbSshTunnel (SSH reverse tunnel + smart ADB proxy)
├── dependencies.py          # Dependency checker & auto-installer for pip packages + Google Platform-Tools
├── config.py                # Server profile manager (~/.adbridge/config.json) & SSH command parser
├── launcher.cs              # Native Windows GUI executable wrapper source (compiles to ADBridge.exe)
├── setup.ps1                # 1-Click Windows PowerShell installer & Desktop shortcut creator
├── setup.bat                # 1-Click Windows batch installer
├── setup.sh                 # 1-Click Linux / macOS installer (creates .venv) & launcher
├── launch.sh                # Linux / macOS launcher (after setup)
├── Launch-ADBTunnel.bat     # Quick Windows launcher
├── requirements.txt         # Python package dependencies
└── LICENSE                  # MIT License

Security & Privacy

  • Zero Hardcoded Credentials: All server profiles, hostnames, usernames, and passwords are saved locally on your machine in ~/.adbridge/config.json (outside the repository directory) with 0600 permissions on POSIX systems.
  • Loopback-Only Remote Binding: The SSH reverse tunnel binds exclusively to loopback (127.0.0.1 and [::1]) on the remote SSH server—your ADB port is never exposed to the public internet.
  • Local ADB Kill Protection: Remote adb kill-server requests (0009host:kill) are intercepted by the proxy so remote users or scripts cannot terminate your local PC's ADB daemon.

License

Released under the MIT License.

About

Ability connect adb device over ssh servers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages