Reputation: 31
I require a way to insert, remove or modify the hex data bytes in the packet of a pcap file. Is there a tshark command or any other method to do this.
00292c0: 900b 0000 0018 5a82 5a82 a57e 5a82 a57e ......Z.Z..~Z..~
00292d0: a57e a57e 5a82 5a82 a57e 5a82 a57e 5a82 .~.~Z.Z..~Z..~Z.
00292e0: a57e 5a82 5a82 5a82 a57e a57e 5a82 a57e .~Z.Z.Z..~.~Z..~
Suppose I want to modify the first 4 bytes of data from 900b 0000 to 801b 0101 or remove first bytes or add an extra set of bytes at the end after a57e? How shall I do that?
Upvotes: 1
Views: 11049
Reputation: 6254
There are a number of ways to modify packet data. For example:
text2pcap
to convert the modified text file back to a binary pcap file that can then be loaded back into Wireshark, or you can use Wireshark's built-in functionality to directly import the text file containing the modified hex dump of the packets you previously exported via "File -> Import From Hex Dump...". NOTE that when editing packets, especially when adding/removing bytes, you will likely need to make other adjustments as well in order for the packets to still make sense. This is because there are often length fields embedded in the packet data, so you need to be sure that the new length matches the data. And you might have to make changes in several places. And if you care about correct checksums/CRCs, then you may have to adjust those fields as well.Upvotes: 2