Hi, I'm trying to convert a pcap file to binary for use in testing in a new product, I'm working on. I figured the best thing to do was 1...save the file in a .k12 text file, where I get the following format of text file... +---------+---------------+----------+ 09:19:40,736,392 ETHER |0 |00|05|47|02|99|c6|00|03|fa| ........etc etc 2...I parse this text file using a perl script to get 00 05 47 02 99 c6 00 03 fa ........etc etc 3...I then convert this to serial binary data format which I need 000000000000010101000111000000101001 ........etc, etc, which is just the binary format of the hex data. When I this is read by the internet device, I'm working on, I would have expected it to recognise this a valid internet traffic, but it doesn't. I've a few questions... Does the .k12 file contain valid data or are there other headers, that I need to remove before converting it to binary? Are there any endian issues that I need to be aware of when parsing the .k12 file? Alternatively, is there any other method of extracting the data from wireshark into this format? Regards Mike asked 26 Nov '10, 08:34 stenasc edited 27 Nov '10, 20:06 lchappell ♦ |
3 Answers:
A pcap file is "binary" in the sense that it's not a text file. What are you trying to do with the packets in the pcap file? Transmit them on a network of the same type as the network on which they were captured? If so, then the "Traffic generators" section of the Tools page on the Wireshark Wiki lists some tools you can use to do that, such as tcpreplay and bittwist. answered 26 Nov '10, 23:23 Guy Harris ♦♦ |
Best way would be to use Lua to do it for you
For more info on how to extend wireshark with lua see this guide Lua Scripting in Wireshark
answered 27 Nov ‘10, 15:10 izopizo |
stuck with the same problem, here is how i fixed it. Export the packet as a "C" array. Then replace the "static const unsigned char" with "reg [7:0]" (assuming verilog), replace the 0x of all hex numbers with 8'h and precede all the opening curly brackets with a single quote. This should let you place it directly in to a verilog file. answered 01 Jun '15, 20:43 JDK |
What I'm trying to do is represent the actual packets data as binary which I feed serially into an ethernet phy on an fpga. In the simulation, I would be able to check if the phy is working correctly, but at the moment, the phy is telling me that the data I'm feeding it is invalid.
The easiest way to do that might be to write your own program that reads Ethernet pcap files and writes out the raw packet data in the appropriate format (to a file or to the FPGA). For help on doing this, you should probably ask the [email protected] or [email protected] mailing lists.