Skip to content

Instantly share code, notes, and snippets.

@zackdouglas
Created April 22, 2014 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackdouglas/11179325 to your computer and use it in GitHub Desktop.
Save zackdouglas/11179325 to your computer and use it in GitHub Desktop.
sniff network traffic on a given interface and displays the IP addresses of the machines communicating with the current host (one IP per line)
netsniff () {
sudo tcpdump -i wlan0 -n ip | \
awk '{ print gensub(/(.*)\..*/,"\\1","g",$3), $4, gensub(/(.*)\..*/,"\\1","g",$5) }' | \
awk -F " > " '{print $1"\n"$2}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment