System-wide & per-app proxy management for rooted Android
Route any app through any proxy — HTTP, SOCKS, transparent TPROXY — without touching app code.
| Feature | Method | Layer |
|---|---|---|
| 🌐 System-wide HTTP proxy | Settings.Global.HTTP_PROXY |
Magisk (root) |
| 🔀 Transparent proxy (all TCP) | iptables TPROXY |
Magisk (root) |
| 📱 Per-app proxy (iptables) | iptables -m owner --uid-owner |
Magisk (root) |
| 🪝 Per-app proxy (hook) | OkHttp / ProxySelector hooks | LSPosed |
| 🗄️ Proxy profile management | Room DB | App |
| 🧪 Proxy connectivity test | OkHttp direct test | App |
| ⚡ CLI / Intent API | BroadcastReceiver | App |
| 🔁 Auto-restore on boot | BootReceiver + Foreground Service | App |
SYSTEM → Settings.Global.HTTP_PROXY (HTTP/HTTPS, most apps)
TPROXY → iptables PREROUTING TPROXY (all TCP, transparent)
PER_APP → iptables OUTPUT MARK per UID (selected apps only)
+ LSPosed hooks (OkHttp, ProxySelector, WebView)
┌─────────────────────────────────────────────────────────────┐
│ Android App (APK) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Compose UI │ │ ViewModel │ │ Room Database │ │
│ │ - HomeScreen│ │ ProxyVM │ │ - proxies │ │
│ │ - AddProxy │ │ │ │ - app_proxies │ │
│ │ - AppProxy │ │ │ │ │ │
│ │ - Settings │ │ │ │ │ │
│ └──────────────┘ └──────────────┘ └──────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Intent/CLI API (BroadcastReceiver) │ │
│ │ SET_GLOBAL_PROXY | CLEAR_GLOBAL | SET_APP_PROXY ... │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ su │ config.json
▼ ▼
┌─────────────────────┐ ┌──────────────────────────────────┐
│ Magisk Module │ │ LSPosed Module │
│ │ │ │
│ service.sh (root) │ │ XposedInit.kt │
│ - iptables TPROXY │ │ - Hook ProxySelector │
│ - Settings.Global │ │ - Hook OkHttp3 │
│ - Named pipe IPC │ │ - Hook WebView │
│ │ │ - Per-app config from JSON │
└─────────────────────┘ └──────────────────────────────────┘
│
▼
┌─────────────────────┐
│ /data/local/ │
│ proxy-manager/ │
│ ├── config.json │ ← shared config (app ↔ magisk ↔ lsposed)
│ ├── cmd.pipe │ ← named pipe for IPC
│ └── service.pid │
└─────────────────────┘
- Rooted Android 8.0+ with Magisk 20.4+
- LSPosed installed (for per-app hook mode)
- ADB or Android Studio for sideloading
cd magisk-module
zip -r proxy-manager-magisk.zip .
# Flash via Magisk Manager → Modules → Install from storagecd app
./gradlew assembleDebug
adb install app/build/outputs/apk/debug/app-debug.apk- Open LSPosed Manager
- Enable Proxy Manager module
- Select target apps in scope
- Reboot or force-stop target apps
Control the proxy from ADB or any automation tool:
# Set global proxy — HTTP mode
adb shell am broadcast -a com.proxymanager.SET_GLOBAL_PROXY \
--es host "1.2.3.4" --ei port 8080 --es mode "SYSTEM"
# Set global proxy — transparent TPROXY mode
adb shell am broadcast -a com.proxymanager.SET_GLOBAL_PROXY \
--es host "1.2.3.4" --ei port 8080 --es mode "TPROXY"
# Clear global proxy
adb shell am broadcast -a com.proxymanager.CLEAR_GLOBAL_PROXY
# Set per-app proxy (proxy_id from DB)
adb shell am broadcast -a com.proxymanager.SET_APP_PROXY \
--es package "com.example.app" --el proxy_id 1
# Clear per-app proxy
adb shell am broadcast -a com.proxymanager.CLEAR_APP_PROXY \
--es package "com.example.app"
# Toggle proxy on/off
adb shell am broadcast -a com.proxymanager.TOGGLE_PROXY
# Reload config (after manual config.json edit)
adb shell am broadcast -a com.proxymanager.RELOAD_CONFIGShared config at /data/local/proxy-manager/config.json:
{
"enabled": true,
"mode": "tproxy",
"global_proxy": "1.2.3.4:8080",
"tproxy_port": 8118,
"app_proxies": {
"com.example.app": {
"host": "1.2.3.4",
"port": 8080,
"type": "HTTP",
"uid": 10123,
"enabled": true
}
}
}android-proxy-rooted/
├── magisk-module/ # Magisk module (flash as zip)
│ ├── module.prop
│ ├── customize.sh # Installer
│ ├── post-fs-data.sh # Early boot setup
│ ├── service.sh # Root service (iptables + IPC)
│ └── META-INF/
│
└── app/ # Android Studio project
└── app/src/main/
├── AndroidManifest.xml
├── assets/xposed_init # LSPosed entry point
└── java/com/proxymanager/
├── data/ # Room DB, Repository, DataStore
├── root/ # RootCommand, IptablesManager, ProxyTester
├── service/ # ProxyService, IntentReceiver, BootReceiver
├── ui/ # Compose screens
├── viewmodel/ # ProxyViewModel
├── xposed/ # LSPosed hooks (XposedInit)
└── di/ # Hilt modules
com.proxymanager.CONTROLpermission issignature|privileged— only same-signed or system apps can send control intents- ADB shell (
adb shell) bypasses this for testing/automation - Config at
/data/local/proxy-manager/must be readable by LSPosed hooks running in other app processes - See SECURITY.md for vulnerability reporting
Contributions are welcome! Please read CONTRIBUTING.md before submitting a PR.
MIT © 2026 Android Proxy Manager Contributors