-
-
Save Fuseteam/52851ed10aed0f680883c71c4949e6a1 to your computer and use it in GitHub Desktop.
wirelessly connect adb over ip and port discovered by nmap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/awk -f | |
| # USAGE: | |
| # download and save in ~/.local/bin (e.g. as adbw) | |
| # make executable chmod +x ~/.local/bin/adbw | |
| # run adbw 192.168.1.232 | |
| BEGIN{ | |
| FS = "[ /]" | |
| ARGC=2 | |
| # Use -Pn to skip host discovery, --max-retries to only try each port once, --min-rate to send package no slower than 2000 per second | |
| c="nmap -Pn --max-retries 2 --min-rate 2000 "ARGV[1]" -p 32768-60999" | |
| print "scanning "ARGV[1]"..." | |
| while(c|getline) { | |
| if (/\/tcp/) { | |
| device=ARGV[1]":"$1 | |
| print "found: "device | |
| } | |
| } | |
| close(c) | |
| if( device != ""){ | |
| print "connecting..." | |
| system("adb connect "device) | |
| }else { | |
| print "No ADB port found" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment