Skip to content

Instantly share code, notes, and snippets.

@pinge
Created February 11, 2016 20:29
Show Gist options
  • Save pinge/92ca76952e882a5d6d11 to your computer and use it in GitHub Desktop.
Save pinge/92ca76952e882a5d6d11 to your computer and use it in GitHub Desktop.
tcpdump

dumping request and response headers from tcpdump in a human readable way:

sudo stdbuf -oL -eL /usr/sbin/tcpdump -A -s 10240 "tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | egrep -a --line-buffered ".+(GET |HTTP\/|POST )|^[A-Za-z0-9-]+: " | perl -nle 'BEGIN{$|=1} { s/.*?(GET |HTTP\/[0-9.]* |POST )/\n$1/g; print }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment