Problem using tcpdump and strings
Posted: Fri May 17, 2013 11:40 pm
I'm trying to use tcpdump to monitor network traffic for port 80. I'm passing the output of tcpdump through strings so that I only see the readable text. This all seems to be working fine with this command:
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings
The problem is I can't seem to capture the output of strings. For example, I can't even direct the output to a file. All I end up with is a file of zero length.
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings >> output.txt
What I really want to do is grep the output of strings for a particular pattern, such as:
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings | grep 'xyzzy'
However, I get no output, even when I know the pattern xyzzy is in the stream.
The closest I've been able to come to a solution is to use the tee command, but it seems awkward.
Any ideas? Thanks!
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings
The problem is I can't seem to capture the output of strings. For example, I can't even direct the output to a file. All I end up with is a file of zero length.
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings >> output.txt
What I really want to do is grep the output of strings for a particular pattern, such as:
sudo tcpdump -ieth0 -s0 -w - tcp dst port 80 | strings | grep 'xyzzy'
However, I get no output, even when I know the pattern xyzzy is in the stream.
The closest I've been able to come to a solution is to use the tee command, but it seems awkward.
Any ideas? Thanks!