Created
November 6, 2023 14:12
-
-
Save baioc/96fd4e893b56d78dfce6817374c71f9d to your computer and use it in GitHub Desktop.
Extract payload data from captured TCP stream
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
#!/bin/sh | |
# | |
# Example usage: | |
# cat tcpdump.pcap | ./readtcpcap.sh 1 > stream1 | |
# | |
if [ -z "$1" ]; then | |
echo 'You have to specify a TCP stream!' | |
exit 1 | |
else | |
stream=$1 | |
fi | |
tshark -r '-' -Q -z "follow,tcp,raw,$stream" | \ | |
head -n -1 | tail -n +7 | \ | |
sed 's/^\s\+//g' | \ | |
xxd -r -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment