开发者

Is there a library for parsing/formatting TCP packets or anything that would help doing it?

开发者 https://www.devze.com 2023-03-08 10:45 出处:网络
My application uses tcp to connect to my server and I am packet sniffing it to see how it works using wireshark, the first thing that crossed my mind is the packets that are coming to me in hex so man

My application uses tcp to connect to my server and I am packet sniffing it to see how it works using wireshark, the first thing that crossed my mind is the packets that are coming to me in hex so manually looking and decoding is very hard.

So I tough was doing a parser开发者_StackOverflow社区 where I do things like:

<packet id="0x01" name="undefined">
    <part name="userID" type="d"/>
</packet>

Where d is for decimal and would get 4 bytes to it.

My goal is to make something like this:

Is there a library for parsing/formatting TCP packets or anything that would help doing it?

And below it a listview with the packet name as root and the part names inside with their value.

I was looking around and found libraries to sniff the data etc but what I was really looking for is something that would help me parse/format it, is there any around ?


What you are looking for is the decoded packets, unfortunately from the perspective of TCP what you are looking at is already the decoded packet.
To get additional information you need a protocol dissector that operates on a higher level protocol. For off the shelf protocols such a dissector probably already exists, but if you rolled your own protocol you will also need to roll your own dissector. There is a tutorial on codeproject for building a custom dissector for wireshark which should help you get started if you want to go this route.

0

精彩评论

暂无评论...
验证码 换一张
取 消