Last active
August 29, 2015 13:57
-
-
Save probonopd/9569289 to your computer and use it in GitHub Desktop.
Connect to the device with known MAC address but unknown Ethernet addres
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
| #!/bin/bash | |
| # Connect to the device with known MAC address but unknown Ethernet addres | |
| ## Or simply: | |
| ## sudo nmap -sP 192.168.180.0/24 | grep "FE:ED" | |
| MAC="10:FE:ED" # Can be just partial | |
| OWNIP=$(LANG="" ifconfig | grep "inet addr" | head -n 1 | cut -d ":" -f 2 | cut -d " " -f 1) | |
| SUBNET="$(echo $OWNIP | cut -d "." -f 1).$(echo $OWNIP | cut -d "." -f 2).$(echo $OWNIP | cut -d "." -f 3).0/24" | |
| ssh $(sudo nmap -sP $SUBNET | grep FE:ED -C 2 | head -n 1 | cut -d " " -f 5) -l root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment