I want to have pcap file with decrypted SSL data in it. I am running tshark like this-
When I review Is this expected behaviour? If so, how do I go about getting plaintext data directly in pcap file Version info Linux Kernel - Linux debian1 3.2.0-4-amd64 Distribution - Debian Stable TShark version - 1.8.2 asked 22 Oct '14, 03:03 gauravphoenix |
2 Answers:
Yep, that's expected, the data is only decrypted for display purposes, the packets written to the output file are those from the input that have passed any supplied filters. Think about what you're asking for, the protocols in your capture were originally something like ethernet -> ip -> tcp -> ssl -> payload, and you now want to "remove" the ssl layer and end up with ethernet -> ip -> tcp -> payload, so all the headers of the protocols underlying the ssl payload would need to be adjusted for lengths, checksums, sequence numbers etc. You could use tshark to output the decrypted text and then use some other application to stuff that back into a pcap to give you the required info, but I don't know what the "other application" is. answered 22 Oct '14, 03:25 grahamb ♦ |
As Graham said, this is expected. But if you can use the GUI then you have access to the "Export PDUs to file" function (under the File menu) which allows you to export decrypted packets into a new PCAP file. (Note, though, that new PCAP file will probably only be readable by Wireshark; other programs using the PCAP format probably won't understand Wireshark's special "exported PDUs" DLT value.) answered 22 Oct '14, 05:11 JeffMorriss ♦ |
Thanks for detailed answer. What is the most elegant way for saving plaintext data from tshark?
Depends on how you want to process it, you can use plain text, csv, psml, pdml or postscript, and probably hex as well.
You could also limit the output to just the payload protocol.
Wiresharks Export PDU function can export the decrypted layer above SSL to a pcap file retaining meta information of the packets like src/dst IP of original frame etc. But it's not available fom tshark yet.