Skip to content

Instantly share code, notes, and snippets.

@comm1x
Created March 16, 2016 20:10
Show Gist options
  • Save comm1x/d5692a624c3028b5bbea to your computer and use it in GitHub Desktop.
Save comm1x/d5692a624c3028b5bbea to your computer and use it in GitHub Desktop.
HTTPDump - bash wrapper for TCPDump
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo 'HTTPDump - wrapper for TCPDump'
echo 'Usage: httpdump [HOST|any]'
exit 0
fi
host=$1
host_cond=""
if [[ $host != 'any' ]]; then
host_cond="and (dst ${host} or src ${host})"
fi
http_cond="and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
sudo tcpdump -A -s 0 "tcp port 80 ${http_cond} ${host_cond}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment