Skip to content

Instantly share code, notes, and snippets.

@KrustyHack
Last active January 26, 2021 13:17
Show Gist options
  • Save KrustyHack/54e9298a963bfac04a2f7e199074d381 to your computer and use it in GitHub Desktop.
Save KrustyHack/54e9298a963bfac04a2f7e199074d381 to your computer and use it in GitHub Desktop.
Kubernetes and Shit
  1. To monitor HTTP traffic including request and response headers and message body:

tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

  1. To monitor HTTP traffic including request and response headers and message body from a particular source:

tcpdump -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

  1. To monitor HTTP traffic including request and response headers and message body from local host to local host:

tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo

  1. To only include HTTP requests, modify “tcp port 80” to “tcp dst port 80” in above commands

  2. Capture TCP packets from local host to local host

tcpdump -i lo

Credits to https://sites.google.com/site/jimmyxu101/testing/use-tcpdump-to-monitor-http-traffic

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