Skip to content

Instantly share code, notes, and snippets.

@probonopd
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save probonopd/9569289 to your computer and use it in GitHub Desktop.

Select an option

Save probonopd/9569289 to your computer and use it in GitHub Desktop.
Connect to the device with known MAC address but unknown Ethernet addres
#!/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