Created
November 15, 2017 09:58
-
-
Save kaerer/a9b102e08ff28d3d71eadcca0a11fae6 to your computer and use it in GitHub Desktop.
Dump all packages for selected port
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 | |
echo $1 | grep -E -q "^[0-9]+$" || (echo "Please specify a port number to listen to." ; exit 1) | |
PORT=$1 | |
TCPDUMPARG="tcp port $PORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | |
sudo tcpdump -s 0 -A -i eth0 $TCPDUMPARG | |
#TCPDUMPARG="tcp port $PORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment