Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

Simple internet traffic summary with tcpdump & awk

# capture IP addresses on your active network interface while surfing the internet
/usr/sbin/tcpdump -D 
#/usr/bin/sudo /usr/sbin/tcpdump -n | /usr/bin/awk '{printf "%-70s %-70s\n", $3, $5}' | /usr/bin/tee ~/Desktop/tcpdump.txt
/usr/bin/sudo /usr/sbin/tcpdump | /usr/bin/awk '{printf "%-70s %-70s\n", $3, $5}' | /usr/bin/tee ~/Desktop/tcpdump.txt


# extract IP numbers of visited web sites, etc.
/usr/bin/sed -E -e 's/(([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3})[^[:space:]]*/\1/g' ~/Desktop/tcpdump.txt | /usr/bin/sort -u | /usr/bin/nl



Further information:

- A tcpdump Tutorial / Primer
- Understanding tcpdump
- tcpdump for Dummies
- Simple Usage Of tcpdump
- Quick and simple usage of tcpdump (packet sniffer)
- How to use TCPDump
- tcpdump-usage
- Spy on Yourself with tcpdump
- Examining and dissecting tcpdump/libpcap traces
- trace-summary - Generating network traffic summaries
- Getting a Packet Trace
- Saving a packet trace in Mac OS X
- Mac OS X packages for Wireshark
- ipfwdump, ipfwto & ipfwfrom
- Analyze internet traffic volume with dynamic ipfw rules

1 total