This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

How can I convert an .xml file to a .pcap file

0

How can I convert an .xml file to a .pcap file,so that I can analyze the protocols I get.

asked 03 May '13, 02:42

kiyomi's gravatar image

kiyomi
1112
accept rate: 0%


One Answer:

0

That depends on the structure and the content of the XML file. If the XML file contains the raw packet bytes, you could extract those bytes from the XML file and write those bytes in a format that text2pacp understands. If the XML file contains just application data, there is a lot more to do and then it's probably better not to analyze that data with Wireshark.

Can you please add some information about the nature and structure of your XML file and who/what generated that file?

Regards
Kurt

answered 03 May '13, 03:11

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

Thanks for your prompt reply! My project contains a part for tracing the protocols that we use to send some message, I get the stream and then I parse it to List<packet(already defined)="">. Then I use jSON to post the packets to front page. But now, another requirement appears, I want to get the jSONArray or something else back, and turn it to .xml file, eventually, I wang to convert the xml file to pcap(or some else file formats that the Wireshark can read). Thank you again for your help.Thanks for your prompt reply!The jSONArrays is generated as follows: I use "tshark -T pdml" in linux terminal, and then I parse the inputstream to get the packet I want, then I use dom4j to generate List<packet>, then turn that to jSON. Thank you again for your help.

(03 May '13, 19:50) kiyomi

I have also the same problem can you help me?

(17 Aug '17, 02:14) Wegang

@Wegang, please open your own question with your xml file rather than trying to piggy-back on to a long dormant older question.

(17 Aug '17, 02:45) grahamb ♦