Skip to content

Instantly share code, notes, and snippets.

@RunnerRick
Last active June 14, 2017 05:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RunnerRick/6554392 to your computer and use it in GitHub Desktop.
Save RunnerRick/6554392 to your computer and use it in GitHub Desktop.
Using TCPDUMP to monitor incoming HTTP traffic (poor man's Wireshark).
#!/usr/bin/env bash
echo $1 | grep -E -q "^[0-9]+$" || (echo "Please specify a port number to listen to." ; exit 1)
PORT=$1
TCPDUMPARG="tcp port $PORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
sudo tcpdump -s 0 -A -i lo0 $TCPDUMPARG
# See also http://naleid.com/blog/2008/04/03/monitoring-http-traffic-to-debug-your-grails-application/
@thiagoghisi
Copy link

Amazing stuff! Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment