Skip to content

Instantly share code, notes, and snippets.

@bicccio
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bicccio/26d0a730917b4442a508 to your computer and use it in GitHub Desktop.
Save bicccio/26d0a730917b4442a508 to your computer and use it in GitHub Desktop.
discover LAN (mac)
#!/bin/sh
eth=$(ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'| egrep -o -m 1 '^[^\t:]+') && nmap -sP $(ifconfig $eth | grep -w 'inet' | cut -d' ' -f2 | cut -d'.' -f1-3)".1/24"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment