Created
March 16, 2016 20:10
-
-
Save comm1x/d5692a624c3028b5bbea to your computer and use it in GitHub Desktop.
HTTPDump - bash wrapper for TCPDump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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