Created
May 7, 2013 19:07
-
-
Save spraints/5535231 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# Make sure sudoing works first, because tcpdump is going in the background | |
sudo -p "Root privileges are required in order to run tcpdump. Password: " test | |
pcap=$TMPDIR/nethog.$$.pcap | |
# 10.0.1.1 is my LAN's AirPort Extreme, so it gets lots of backup traffic. | |
sudo tcpdump -i en0 -w $pcap not host 10.0.1.1 >&/dev/null & | |
tcpdump_pid=$! | |
trap '{ kill $tcpdump_pid ; rm -f $pcap ; exit ; }' INT | |
# Only show as much tcptrace as fits on the screen. | |
watch -d "tcptrace -b -n $pcap 2>/dev/null"'| head -n $(tput lines)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment