by alexpotato · 3y ago · 0 comments
What does it do?
It can reassemble TCP packets back into the FULL body of the original message sent. e.g. if you make a HTTP GET request, it will show you the full text in a file stamped with the time, source and dest ips and port.
Things I've found it REALLY useful for:
- migrating a data center
- for some reason, connection works fine on the old DC but seems to time out in weird ways in the new DC
- No one can figure it out
- I suggest using tcpflow
- Turn out there was a setting in the new DC network hardware that was truncating larger packets and the authorization message was just over the threshold
People always say "yeah, but Wireshark" which is true, that's a good tool too. That being said, there is just something about seeing the "raw" text of a message sent by a machine over the wire and being able to see it in text from the command line.
By example:
$ tshark -i lo -l -q -Y http -T fields -e frame.time -e _ws.col.Info -e http.file_data
Running as user "root" and group "root". This could be dangerous.
Capturing on 'Loopback: lo'
Dec 19, 2022 04:07:12.419196072 UTC GET / HTTP/1.0
Dec 19, 2022 04:07:12.420560079 UTC HTTP/1.1 200 OK (text/plain) Hello World!\n
Dec 19, 2022 04:07:12.504444583 UTC GET /favicon.ico HTTP/1.0
Dec 19, 2022 04:07:12.505691738 UTC HTTP/1.1 404 Not Found
Because -l (flush every line to stdout) and -q (suppress packet counts) you can pipe the command to grep. $ tshark -i lo -l -q -Y http -T fields -e frame.time -e _ws.col.Info -e http.file_data 2>&1 | grep 404
Dec 19, 2022 04:09:46.361304160 UTC HTTP/1.1 404 Not Found
More examples:https://hackertarget.com/tshark-tutorial-and-filter-examples...
I wonder if tcpflow would make this easier, or maybe just different, by effectively pre-slicing the capture into sessions.