adblab 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
adblab-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: adblab
3
+ Version: 0.1.0
4
+ Summary: All-in-one Android Debug Bridge (ADB) toolkit for wireless debugging, device management, and diagnostics.
5
+ Author-email: Aditya Pidurkar <adityapidurkar01@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/itsadityapidurkar/adblab
8
+ Project-URL: Repository, https://github.com/itsadityapidurkar/adblab.git
9
+ Project-URL: Issues, https://github.com/itsadityapidurkar/adblab/issues
10
+ Keywords: adb,android,wireless-debugging,toolkit,adblab,developer-tools
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Debuggers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Operating System :: MacOS
23
+ Classifier: Operating System :: Microsoft :: Windows
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+
27
+ # adblab
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/adblab.svg)](https://pypi.org/project/adblab/)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
31
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
32
+
33
+ **adblab** is an all-in-one Android Debug Bridge (ADB) CLI and diagnostic laboratory designed to make ADB operations fast, automatic, and hassle-free.
34
+
35
+ Cross-platform support for **Linux**, **macOS**, and **Windows**.
36
+
37
+ ---
38
+
39
+ ## Features
40
+
41
+ - **Zero-Manual-Typing**: Discovers Android devices broadcasting on your local Wi-Fi network using mDNS (`_adb-tls-connect._tcp` and `_adb-tls-pairing._tcp`).
42
+ - **Interactive Menu**: Automatically lists available devices; select your target phone with a single keypress.
43
+ - **Smart Pairing Wizard**: Detects if your machine hasn't been paired yet and guides you through entering the 6-digit pairing code.
44
+ - **Cross-Platform**: Automatically locates the Android SDK `adb` binary across standard installation directories on Linux, macOS, and Windows.
45
+ - **Zero Heavy Dependencies**: Pure standard library implementation.
46
+
47
+ ---
48
+
49
+ ## Installation
50
+
51
+ ### Via PyPI
52
+ ```bash
53
+ pip install adblab
54
+ ```
55
+
56
+ Or using `pipx` (recommended on Linux distributions):
57
+ ```bash
58
+ pipx install adblab
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Usage
64
+
65
+ ### 1. Interactive Auto-Connect (Default)
66
+ Simply run:
67
+ ```bash
68
+ adblab
69
+ ```
70
+ *(You can also use the shorthand command `adb-wifi`)*
71
+
72
+ The tool will:
73
+ 1. Scan for Android devices with Wireless Debugging enabled on your Wi-Fi.
74
+ 2. Present a menu of discovered phones.
75
+ 3. Attempt instant connection.
76
+ 4. If not paired yet, it automatically opens the pairing wizard and connects after you enter the 6-digit code.
77
+
78
+ ---
79
+
80
+ ### 2. Subcommands
81
+
82
+ - **Scan for broadcasting devices**:
83
+ ```bash
84
+ adblab scan
85
+ ```
86
+
87
+ - **Show connected devices**:
88
+ ```bash
89
+ adblab status
90
+ ```
91
+
92
+ - **Switch USB-connected phone to Wi-Fi mode**:
93
+ ```bash
94
+ adblab tcpip
95
+ ```
96
+
97
+ - **Pair directly**:
98
+ ```bash
99
+ adblab pair 192.168.1.50:41235 123456
100
+ ```
101
+
102
+ - **Connect directly**:
103
+ ```bash
104
+ adblab connect 192.168.1.50:38421
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Prerequisites (On Your Android Phone)
110
+
111
+ 1. Connect your phone to the same Wi-Fi network as your computer.
112
+ 2. Enable Developer Options:
113
+ - Go to **Settings** -> **About Phone** -> Tap **Build Number** 7 times.
114
+ 3. Open **Developer Options**:
115
+ - Turn ON **Wireless debugging**.
116
+ - For first-time pairing, tap on **Pair device with pairing code**.
117
+
118
+ ---
119
+
120
+ ## License
121
+
122
+ MIT License. Copyright (c) 2026 Aditya Pidurkar.
adblab-0.1.0/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # adblab
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/adblab.svg)](https://pypi.org/project/adblab/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
6
+
7
+ **adblab** is an all-in-one Android Debug Bridge (ADB) CLI and diagnostic laboratory designed to make ADB operations fast, automatic, and hassle-free.
8
+
9
+ Cross-platform support for **Linux**, **macOS**, and **Windows**.
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ - **Zero-Manual-Typing**: Discovers Android devices broadcasting on your local Wi-Fi network using mDNS (`_adb-tls-connect._tcp` and `_adb-tls-pairing._tcp`).
16
+ - **Interactive Menu**: Automatically lists available devices; select your target phone with a single keypress.
17
+ - **Smart Pairing Wizard**: Detects if your machine hasn't been paired yet and guides you through entering the 6-digit pairing code.
18
+ - **Cross-Platform**: Automatically locates the Android SDK `adb` binary across standard installation directories on Linux, macOS, and Windows.
19
+ - **Zero Heavy Dependencies**: Pure standard library implementation.
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ ### Via PyPI
26
+ ```bash
27
+ pip install adblab
28
+ ```
29
+
30
+ Or using `pipx` (recommended on Linux distributions):
31
+ ```bash
32
+ pipx install adblab
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Usage
38
+
39
+ ### 1. Interactive Auto-Connect (Default)
40
+ Simply run:
41
+ ```bash
42
+ adblab
43
+ ```
44
+ *(You can also use the shorthand command `adb-wifi`)*
45
+
46
+ The tool will:
47
+ 1. Scan for Android devices with Wireless Debugging enabled on your Wi-Fi.
48
+ 2. Present a menu of discovered phones.
49
+ 3. Attempt instant connection.
50
+ 4. If not paired yet, it automatically opens the pairing wizard and connects after you enter the 6-digit code.
51
+
52
+ ---
53
+
54
+ ### 2. Subcommands
55
+
56
+ - **Scan for broadcasting devices**:
57
+ ```bash
58
+ adblab scan
59
+ ```
60
+
61
+ - **Show connected devices**:
62
+ ```bash
63
+ adblab status
64
+ ```
65
+
66
+ - **Switch USB-connected phone to Wi-Fi mode**:
67
+ ```bash
68
+ adblab tcpip
69
+ ```
70
+
71
+ - **Pair directly**:
72
+ ```bash
73
+ adblab pair 192.168.1.50:41235 123456
74
+ ```
75
+
76
+ - **Connect directly**:
77
+ ```bash
78
+ adblab connect 192.168.1.50:38421
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Prerequisites (On Your Android Phone)
84
+
85
+ 1. Connect your phone to the same Wi-Fi network as your computer.
86
+ 2. Enable Developer Options:
87
+ - Go to **Settings** -> **About Phone** -> Tap **Build Number** 7 times.
88
+ 3. Open **Developer Options**:
89
+ - Turn ON **Wireless debugging**.
90
+ - For first-time pairing, tap on **Pair device with pairing code**.
91
+
92
+ ---
93
+
94
+ ## License
95
+
96
+ MIT License. Copyright (c) 2026 Aditya Pidurkar.
@@ -0,0 +1,9 @@
1
+ """
2
+ adblab: All-in-one Android Debug Bridge (ADB) CLI and diagnostic laboratory.
3
+ Provides zero-config wireless debugging, device orchestration, pairing,
4
+ and cross-platform platform-tools execution.
5
+ """
6
+
7
+ __version__ = "0.1.0"
8
+ __author__ = "Aditya Pidurkar"
9
+ __email__ = "adityapidurkar01@gmail.com"
@@ -0,0 +1,4 @@
1
+ from adblab.cli import cli_main
2
+
3
+ if __name__ == "__main__":
4
+ cli_main()
@@ -0,0 +1,74 @@
1
+ """
2
+ Cross-platform ADB discovery and execution helper.
3
+ """
4
+
5
+ from __future__ import annotations
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+ from pathlib import Path
11
+
12
+
13
+ def find_adb() -> str | None:
14
+ """Find the path to the adb binary across Linux, macOS, and Windows."""
15
+ # 1. Check system PATH
16
+ found = shutil.which("adb")
17
+ if found:
18
+ return found
19
+
20
+ # 2. Check ANDROID_HOME / ANDROID_SDK_ROOT environment variables
21
+ env_roots = [
22
+ os.environ.get("ANDROID_HOME"),
23
+ os.environ.get("ANDROID_SDK_ROOT"),
24
+ ]
25
+ for env in env_roots:
26
+ if env:
27
+ candidate = Path(env) / "platform-tools" / ("adb.exe" if os.name == "nt" else "adb")
28
+ if candidate.is_file() and os.access(candidate, os.X_OK):
29
+ return str(candidate)
30
+
31
+ # 3. Known standard installation paths
32
+ home = Path.home()
33
+ candidates = [
34
+ home / "Android" / "Sdk" / "platform-tools" / "adb", # Linux standard
35
+ home / ".local" / "bin" / "adb",
36
+ home / "Library" / "Android" / "sdk" / "platform-tools" / "adb", # macOS standard
37
+ Path("/opt/android-sdk/platform-tools/adb"),
38
+ Path("/usr/lib/android-sdk/platform-tools/adb"),
39
+ ]
40
+
41
+ if os.name == "nt":
42
+ local_app_data = os.environ.get("LOCALAPPDATA")
43
+ if local_app_data:
44
+ candidates.append(Path(local_app_data) / "Android" / "Sdk" / "platform-tools" / "adb.exe")
45
+ program_files = os.environ.get("ProgramFiles")
46
+ if program_files:
47
+ candidates.append(Path(program_files) / "Android" / "android-sdk" / "platform-tools" / "adb.exe")
48
+
49
+ for candidate in candidates:
50
+ if candidate.is_file():
51
+ return str(candidate)
52
+
53
+ return None
54
+
55
+
56
+ def run_adb(args: list[str], timeout: int = 15) -> tuple[str, str, int]:
57
+ """Execute an ADB command safely and return (stdout, stderr, returncode)."""
58
+ adb_path = find_adb()
59
+ if not adb_path:
60
+ return "", "ADB binary not found. Please install Android Platform Tools.", 127
61
+
62
+ cmd = [adb_path] + args
63
+ try:
64
+ res = subprocess.run(
65
+ cmd,
66
+ capture_output=True,
67
+ text=True,
68
+ timeout=timeout,
69
+ )
70
+ return res.stdout.strip(), res.stderr.strip(), res.returncode
71
+ except subprocess.TimeoutExpired:
72
+ return "", f"ADB command timed out after {timeout} seconds", 1
73
+ except OSError as err:
74
+ return "", str(err), 1
@@ -0,0 +1,308 @@
1
+ """
2
+ Interactive wireless ADB connection and pairing manager.
3
+ """
4
+
5
+ from __future__ import annotations
6
+ import argparse
7
+ import os
8
+ import sys
9
+ import time
10
+ from typing import Dict, List, Tuple
11
+
12
+ from adblab.adb import find_adb, run_adb
13
+
14
+
15
+ class Colors:
16
+ """Terminal colors with auto-disable on Windows legacy consoles or non-TTY."""
17
+ ENABLED = sys.stdout.isatty() and (os.name != "nt" or "WT_SESSION" in os.environ or "TERM" in os.environ)
18
+ CYAN = "\033[96m" if ENABLED else ""
19
+ GREEN = "\033[92m" if ENABLED else ""
20
+ YELLOW = "\033[93m" if ENABLED else ""
21
+ RED = "\033[91m" if ENABLED else ""
22
+ BOLD = "\033[1m" if ENABLED else ""
23
+ RESET = "\033[0m" if ENABLED else ""
24
+
25
+
26
+ def get_connected_devices() -> List[dict]:
27
+ """Retrieve list of currently connected ADB devices."""
28
+ out, _, _ = run_adb(["devices", "-l"])
29
+ devices = []
30
+ lines = out.splitlines()
31
+ if len(lines) > 1:
32
+ for line in lines[1:]:
33
+ line = line.strip()
34
+ if not line:
35
+ continue
36
+ parts = line.split()
37
+ if len(parts) >= 2:
38
+ devices.append({
39
+ "id": parts[0],
40
+ "status": parts[1],
41
+ "details": " ".join(parts[2:]) if len(parts) > 2 else ""
42
+ })
43
+ return devices
44
+
45
+
46
+ def scan_mdns() -> Tuple[List[dict], List[dict]]:
47
+ """Scan local network for connect and pairing mDNS services."""
48
+ out, _, _ = run_adb(["mdns", "services"])
49
+ connect_devices = []
50
+ pairing_devices = []
51
+
52
+ for line in out.splitlines():
53
+ line = line.strip()
54
+ if not line or line.startswith("List of discovered"):
55
+ continue
56
+ parts = line.split()
57
+ if len(parts) >= 3:
58
+ name, svc_type, addr = parts[0], parts[1], parts[2]
59
+ ip = addr.split(":")[0] if ":" in addr else addr
60
+ port = addr.split(":")[1] if ":" in addr else ""
61
+ item = {"name": name, "ip": ip, "port": port, "addr": addr}
62
+
63
+ if "_adb-tls-connect" in svc_type or "_adb._tcp" in svc_type:
64
+ connect_devices.append(item)
65
+ elif "_adb-tls-pairing" in svc_type:
66
+ pairing_devices.append(item)
67
+
68
+ return connect_devices, pairing_devices
69
+
70
+
71
+ def try_connect(addr: str) -> Tuple[bool, str]:
72
+ """Attempt connecting to an Android device over TCP."""
73
+ out, err, _ = run_adb(["connect", addr], timeout=8)
74
+ msg = out or err
75
+ if "connected to" in msg.lower() and "cannot" not in msg.lower() and "failed" not in msg.lower():
76
+ return True, msg
77
+ return False, msg
78
+
79
+
80
+ def do_pair(pair_target: str, default_code: str | None = None) -> bool:
81
+ """Pair a device given its pairing address and 6-digit code."""
82
+ print(f"\n{Colors.BOLD}Phone Pairing Wizard{Colors.RESET}")
83
+ print(f"{Colors.CYAN}1. On your phone, keep the 'Pair device with pairing code' popup OPEN.{Colors.RESET}")
84
+ print(f"{Colors.CYAN}2. Enter the 6-digit Wi-Fi pairing code displayed on your phone.{Colors.RESET}\n")
85
+
86
+ code = default_code or input(f"{Colors.YELLOW}Enter 6-digit pairing code: {Colors.RESET}").strip()
87
+ if not code:
88
+ print(f"{Colors.RED}Pairing cancelled: no code entered.{Colors.RESET}")
89
+ return False
90
+
91
+ print(f"[*] Sending pairing request to {pair_target}...")
92
+ out, err, _ = run_adb(["pair", pair_target, code], timeout=15)
93
+ resp = out or err
94
+ print(f" {resp}")
95
+
96
+ if "successfully paired" in resp.lower():
97
+ print(f"{Colors.GREEN}[+] Pairing successful!{Colors.RESET}")
98
+ return True
99
+ else:
100
+ print(f"{Colors.RED}[-] Pairing failed: {resp}{Colors.RESET}")
101
+ return False
102
+
103
+
104
+ def interactive_flow() -> None:
105
+ """Main interactive menu flow for adbtools."""
106
+ adb_path = find_adb()
107
+ if not adb_path:
108
+ print(f"{Colors.RED}[!] Error: 'adb' binary not found.{Colors.RESET}")
109
+ print("Please install Android platform-tools or add adb to your system PATH.")
110
+ sys.exit(1)
111
+
112
+ print(f"{Colors.BOLD}{Colors.CYAN}=================================================={Colors.RESET}")
113
+ print(f"{Colors.BOLD}{Colors.CYAN} adbtools: Wireless Debugging Manager {Colors.RESET}")
114
+ print(f"{Colors.BOLD}{Colors.CYAN}=================================================={Colors.RESET}\n")
115
+
116
+ # 1. Check existing connection
117
+ connected = get_connected_devices()
118
+ active = [d for d in connected if d["status"] == "device"]
119
+ if active:
120
+ print(f"{Colors.GREEN}[+] Already connected to:{Colors.RESET}")
121
+ for d in active:
122
+ print(f" - {d['id']} ({d['details']})")
123
+ choice = input(f"\nConnect to another device? [y/N]: ").strip().lower()
124
+ if choice not in ("y", "yes"):
125
+ return
126
+
127
+ # 2. Scanning network
128
+ print(f"[*] Scanning local Wi-Fi for Android Wireless Debugging...")
129
+ connect_devs, pair_devs = scan_mdns()
130
+
131
+ if not connect_devs and not pair_devs:
132
+ time.sleep(1.2)
133
+ connect_devs, pair_devs = scan_mdns()
134
+
135
+ # Group devices by IP
136
+ devices_by_ip: Dict[str, dict] = {}
137
+ for d in connect_devs:
138
+ devices_by_ip.setdefault(d["ip"], {})["connect"] = d
139
+ for d in pair_devs:
140
+ devices_by_ip.setdefault(d["ip"], {})["pair"] = d
141
+
142
+ if not devices_by_ip:
143
+ print(f"\n{Colors.RED}[!] No wireless Android devices detected on this Wi-Fi network.{Colors.RESET}")
144
+ print(f"\n{Colors.YELLOW}Checklist:{Colors.RESET}")
145
+ print(" 1. Make sure phone and PC are on the same Wi-Fi subnet.")
146
+ print(" 2. Turn ON 'Wireless debugging' in Developer options.")
147
+ print(" 3. For first-time pairing, tap 'Pair device with pairing code'.")
148
+ return
149
+
150
+ # 3. Interactive Menu
151
+ ip_list = list(devices_by_ip.keys())
152
+ print(f"\n{Colors.BOLD}Found {len(ip_list)} device(s) on Wi-Fi:{Colors.RESET}")
153
+ for idx, ip in enumerate(ip_list, 1):
154
+ info = devices_by_ip[ip]
155
+ name = (info.get("connect") or info.get("pair") or {}).get("name", "Android Device")
156
+ status_tags = []
157
+ if "connect" in info:
158
+ status_tags.append(f"{Colors.GREEN}Ready to connect ({info['connect']['port']}){Colors.RESET}")
159
+ if "pair" in info:
160
+ status_tags.append(f"{Colors.YELLOW}Pairing Mode Open ({info['pair']['port']}){Colors.RESET}")
161
+
162
+ tags_str = " | ".join(status_tags)
163
+ print(f" [{idx}] {Colors.BOLD}{ip}{Colors.RESET} ({name}) -> {tags_str}")
164
+
165
+ selected_ip = None
166
+ if len(ip_list) == 1:
167
+ choice = input(f"\nSelect device [1] (Press Enter for default): ").strip()
168
+ selected_ip = ip_list[0] if choice in ("", "1") else (
169
+ ip_list[int(choice) - 1] if choice.isdigit() and 1 <= int(choice) <= len(ip_list) else None
170
+ )
171
+ else:
172
+ choice = input(f"\nSelect device number [1-{len(ip_list)}]: ").strip()
173
+ if choice.isdigit() and 1 <= int(choice) <= len(ip_list):
174
+ selected_ip = ip_list[int(choice) - 1]
175
+
176
+ if not selected_ip:
177
+ print(f"{Colors.RED}Invalid selection. Exiting.{Colors.RESET}")
178
+ return
179
+
180
+ dev_data = devices_by_ip[selected_ip]
181
+
182
+ # 4. Attempt direct connect first if connect service was discovered
183
+ if "connect" in dev_data:
184
+ target_addr = dev_data["connect"]["addr"]
185
+ print(f"\n[*] Attempting direct connection to {target_addr}...")
186
+ success, msg = try_connect(target_addr)
187
+ if success:
188
+ print(f"{Colors.GREEN}[+] {msg}{Colors.RESET}")
189
+ print(f"{Colors.GREEN}[+] Device connected successfully over Wi-Fi!{Colors.RESET}")
190
+ return
191
+ else:
192
+ print(f"{Colors.YELLOW}[!] Direct connection failed: {msg}{Colors.RESET}")
193
+ print(f"{Colors.YELLOW}[!] Device is not paired with this PC yet.{Colors.RESET}")
194
+
195
+ # 5. Pairing workflow
196
+ pair_addr = None
197
+ if "pair" in dev_data:
198
+ pair_addr = dev_data["pair"]["addr"]
199
+ else:
200
+ print(f"\n{Colors.CYAN}[*] Please open 'Pair device with pairing code' on your phone now.{Colors.RESET}")
201
+ for _ in range(5):
202
+ time.sleep(1)
203
+ _, new_pairs = scan_mdns()
204
+ matched = [p for p in new_pairs if p["ip"] == selected_ip]
205
+ if matched:
206
+ pair_addr = matched[0]["addr"]
207
+ print(f"{Colors.GREEN}[+] Detected pairing screen at {pair_addr}!{Colors.RESET}")
208
+ break
209
+
210
+ if not pair_addr:
211
+ print(f"\n{Colors.YELLOW}Could not auto-detect pairing port.{Colors.RESET}")
212
+ manual_port = input(f"Enter the 5-digit port shown on your phone pairing popup: ").strip()
213
+ if manual_port:
214
+ pair_addr = f"{selected_ip}:{manual_port}"
215
+
216
+ if pair_addr:
217
+ paired = do_pair(pair_addr)
218
+ if paired:
219
+ print(f"\n[*] Waiting for connect service...")
220
+ time.sleep(1.5)
221
+ c_devs, _ = scan_mdns()
222
+ c_target = [d for d in c_devs if d["ip"] == selected_ip]
223
+
224
+ if c_target:
225
+ connect_addr = c_target[0]["addr"]
226
+ else:
227
+ manual_c = input(f"Enter IP:Port shown under main 'Wireless debugging' header: ").strip()
228
+ connect_addr = manual_c if ":" in manual_c else f"{selected_ip}:{manual_c}"
229
+
230
+ print(f"[*] Connecting to {connect_addr}...")
231
+ s, m = try_connect(connect_addr)
232
+ if s:
233
+ print(f"{Colors.GREEN}[+] {m}{Colors.RESET}")
234
+ print(f"{Colors.GREEN}[+] Wireless debugging session established!{Colors.RESET}")
235
+ else:
236
+ print(f"{Colors.RED}[-] {m}{Colors.RESET}")
237
+ else:
238
+ print(f"{Colors.RED}Pairing cancelled or timed out.{Colors.RESET}")
239
+
240
+
241
+ def cli_main() -> None:
242
+ """CLI entrypoint supporting subcommands and direct invocation."""
243
+ parser = argparse.ArgumentParser(
244
+ prog="adblab",
245
+ description="All-in-one Android Debug Bridge (ADB) toolkit for wireless debugging and device management."
246
+ )
247
+ subparsers = parser.add_subparsers(dest="command", help="Available subcommands")
248
+
249
+ # Subcommand: scan
250
+ subparsers.add_parser("scan", help="Scan local network for wireless debugging broadcasts")
251
+
252
+ # Subcommand: status
253
+ subparsers.add_parser("status", help="List active ADB devices and their state")
254
+
255
+ # Subcommand: tcpip
256
+ tcpip_p = subparsers.add_parser("tcpip", help="Switch USB-connected phone to Wi-Fi mode")
257
+ tcpip_p.add_argument("port", nargs="?", default="5555", help="Port to listen on (default: 5555)")
258
+
259
+ # Subcommand: pair
260
+ pair_p = subparsers.add_parser("pair", help="Pair device with code")
261
+ pair_p.add_argument("target", help="IP:Port displayed on pairing screen")
262
+ pair_p.add_argument("code", nargs="?", default=None, help="6-digit pairing code")
263
+
264
+ # Subcommand: connect
265
+ conn_p = subparsers.add_parser("connect", help="Connect directly to IP:Port")
266
+ conn_p.add_argument("target", help="IP:Port to connect")
267
+
268
+ args = parser.parse_args()
269
+
270
+ if not args.command:
271
+ # Default: full interactive wizard
272
+ interactive_flow()
273
+ return
274
+
275
+ if args.command == "scan":
276
+ print("[*] Scanning local network for wireless ADB broadcasts...")
277
+ connect_devs, pair_devs = scan_mdns()
278
+ if not connect_devs and not pair_devs:
279
+ print("[-] No wireless ADB services found.")
280
+ else:
281
+ for d in connect_devs:
282
+ print(f" [Connect] {d['name']:30} {d['addr']}")
283
+ for d in pair_devs:
284
+ print(f" [Pairing] {d['name']:30} {d['addr']}")
285
+
286
+ elif args.command == "status":
287
+ devices = get_connected_devices()
288
+ if not devices:
289
+ print("[-] No devices currently connected.")
290
+ else:
291
+ print("[+] Connected devices:")
292
+ for d in devices:
293
+ print(f" - {d['id']:25} {d['status']:12} {d['details']}")
294
+
295
+ elif args.command == "tcpip":
296
+ out, err, _ = run_adb(["tcpip", args.port])
297
+ print(out or err)
298
+
299
+ elif args.command == "pair":
300
+ do_pair(args.target, default_code=args.code)
301
+
302
+ elif args.command == "connect":
303
+ s, m = try_connect(args.target)
304
+ print(m)
305
+
306
+
307
+ if __name__ == "__main__":
308
+ cli_main()
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.4
2
+ Name: adblab
3
+ Version: 0.1.0
4
+ Summary: All-in-one Android Debug Bridge (ADB) toolkit for wireless debugging, device management, and diagnostics.
5
+ Author-email: Aditya Pidurkar <adityapidurkar01@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/itsadityapidurkar/adblab
8
+ Project-URL: Repository, https://github.com/itsadityapidurkar/adblab.git
9
+ Project-URL: Issues, https://github.com/itsadityapidurkar/adblab/issues
10
+ Keywords: adb,android,wireless-debugging,toolkit,adblab,developer-tools
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Debuggers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Operating System :: MacOS
23
+ Classifier: Operating System :: Microsoft :: Windows
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+
27
+ # adblab
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/adblab.svg)](https://pypi.org/project/adblab/)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
31
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
32
+
33
+ **adblab** is an all-in-one Android Debug Bridge (ADB) CLI and diagnostic laboratory designed to make ADB operations fast, automatic, and hassle-free.
34
+
35
+ Cross-platform support for **Linux**, **macOS**, and **Windows**.
36
+
37
+ ---
38
+
39
+ ## Features
40
+
41
+ - **Zero-Manual-Typing**: Discovers Android devices broadcasting on your local Wi-Fi network using mDNS (`_adb-tls-connect._tcp` and `_adb-tls-pairing._tcp`).
42
+ - **Interactive Menu**: Automatically lists available devices; select your target phone with a single keypress.
43
+ - **Smart Pairing Wizard**: Detects if your machine hasn't been paired yet and guides you through entering the 6-digit pairing code.
44
+ - **Cross-Platform**: Automatically locates the Android SDK `adb` binary across standard installation directories on Linux, macOS, and Windows.
45
+ - **Zero Heavy Dependencies**: Pure standard library implementation.
46
+
47
+ ---
48
+
49
+ ## Installation
50
+
51
+ ### Via PyPI
52
+ ```bash
53
+ pip install adblab
54
+ ```
55
+
56
+ Or using `pipx` (recommended on Linux distributions):
57
+ ```bash
58
+ pipx install adblab
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Usage
64
+
65
+ ### 1. Interactive Auto-Connect (Default)
66
+ Simply run:
67
+ ```bash
68
+ adblab
69
+ ```
70
+ *(You can also use the shorthand command `adb-wifi`)*
71
+
72
+ The tool will:
73
+ 1. Scan for Android devices with Wireless Debugging enabled on your Wi-Fi.
74
+ 2. Present a menu of discovered phones.
75
+ 3. Attempt instant connection.
76
+ 4. If not paired yet, it automatically opens the pairing wizard and connects after you enter the 6-digit code.
77
+
78
+ ---
79
+
80
+ ### 2. Subcommands
81
+
82
+ - **Scan for broadcasting devices**:
83
+ ```bash
84
+ adblab scan
85
+ ```
86
+
87
+ - **Show connected devices**:
88
+ ```bash
89
+ adblab status
90
+ ```
91
+
92
+ - **Switch USB-connected phone to Wi-Fi mode**:
93
+ ```bash
94
+ adblab tcpip
95
+ ```
96
+
97
+ - **Pair directly**:
98
+ ```bash
99
+ adblab pair 192.168.1.50:41235 123456
100
+ ```
101
+
102
+ - **Connect directly**:
103
+ ```bash
104
+ adblab connect 192.168.1.50:38421
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Prerequisites (On Your Android Phone)
110
+
111
+ 1. Connect your phone to the same Wi-Fi network as your computer.
112
+ 2. Enable Developer Options:
113
+ - Go to **Settings** -> **About Phone** -> Tap **Build Number** 7 times.
114
+ 3. Open **Developer Options**:
115
+ - Turn ON **Wireless debugging**.
116
+ - For first-time pairing, tap on **Pair device with pairing code**.
117
+
118
+ ---
119
+
120
+ ## License
121
+
122
+ MIT License. Copyright (c) 2026 Aditya Pidurkar.
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ adblab/__init__.py
4
+ adblab/__main__.py
5
+ adblab/adb.py
6
+ adblab/cli.py
7
+ adblab.egg-info/PKG-INFO
8
+ adblab.egg-info/SOURCES.txt
9
+ adblab.egg-info/dependency_links.txt
10
+ adblab.egg-info/entry_points.txt
11
+ adblab.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ adb-wifi = adblab.cli:cli_main
3
+ adblab = adblab.cli:cli_main
@@ -0,0 +1 @@
1
+ adblab
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "adblab"
7
+ version = "0.1.0"
8
+ description = "All-in-one Android Debug Bridge (ADB) toolkit for wireless debugging, device management, and diagnostics."
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Aditya Pidurkar", email = "adityapidurkar01@gmail.com" }
12
+ ]
13
+ license = "MIT"
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Software Development :: Debuggers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Operating System :: POSIX :: Linux",
26
+ "Operating System :: MacOS",
27
+ "Operating System :: Microsoft :: Windows",
28
+ ]
29
+ keywords = ["adb", "android", "wireless-debugging", "toolkit", "adblab", "developer-tools"]
30
+ requires-python = ">=3.8"
31
+ dependencies = []
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/itsadityapidurkar/adblab"
35
+ Repository = "https://github.com/itsadityapidurkar/adblab.git"
36
+ Issues = "https://github.com/itsadityapidurkar/adblab/issues"
37
+
38
+ [project.scripts]
39
+ adblab = "adblab.cli:cli_main"
40
+ adb-wifi = "adblab.cli:cli_main"
adblab-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+