Quickie for choosing interface for tcpdump
I’m frequently firing up tcpdump on my mac, but then having to restart it with the correct interface if I happened to be on a wireless network (which I frequently am on the mac). I finally got tired of that, so I whipped up a quick script that determines which interface is up and consequently starts tcpdump on that interface. Allow me to `cat /usr/bin/stcpdump` for you:
#!/bin/shINT=`ifconfig | grep -A3 "en.:" | grep -B2 inet\ | head -n 1 | cut -f1 -d:`
sudo tcpdump -i $INT $@
Much better - saves me a big of grief. ;o)
1 Comment so far
Leave a comment
This will come in handy when I get a MacBookPro. Thanks for the recommendation.
By Mikeon 01.01.07 1:39 pm
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>