Skip to content

Instantly share code, notes, and snippets.

@vondraussen
Last active November 12, 2019 04:00
Show Gist options
  • Save vondraussen/c13ade408396ed84e0c21e16485fc017 to your computer and use it in GitHub Desktop.
Save vondraussen/c13ade408396ed84e0c21e16485fc017 to your computer and use it in GitHub Desktop.
simple tcpdump traffic size analysis

capture traffic to specific host over specific time

timeout 10h tcpdump -n -e host 127.0.0.1 -w /tmp/traffic_10h.log

get cumulated size from all traffic - tcpdump version 4.9.2

tcpdump -e -n -r /tmp/traffic_10h.log tcp | sed -r -E -n "s/(^.*, length) ([0-9]{1,4}):(.*)/\2/p" | awk '{sum+=$1; print sum}' | numfmt --to=iec-i --suffix=B --padding=7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment