Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about HttpResponseLayer/HttpRequest #1145

Open
ccworkhard opened this issue Jun 2, 2023 · 18 comments
Open

question about HttpResponseLayer/HttpRequest #1145

ccworkhard opened this issue Jun 2, 2023 · 18 comments

Comments

@ccworkhard
Copy link

In this library, HttpResponseLayer/HttpRequest Layer will analyze the request body. I noticed that it checks each package. I have a question. If a complete http request is divided into two packages and arrives at the server, will the second packet be detected and mark it HTTP?

@seladb
Copy link
Owner

seladb commented Jun 6, 2023

I'm sorry for the delayed response @ccworkhard . HttpRequestLayer and HttpResponseLayer only parse the request header, not the request body. If the header is divided into multiple packets, only the first one will be analyzed. You can know if the header is complete or not by using the method isHeaderComplete()

@seladb seladb added the question label Jun 6, 2023
@ccworkhard
Copy link
Author

I'm sorry for the delayed response @ccworkhard . HttpRequestLayer and HttpResponseLayer only parse the request header, not the request body. If the header is divided into multiple packets, only the first one will be analyzed. You can know if the header is complete or not by using the method isHeaderComplete()

thank you very much.
I'm wonder Is there a way for me to implement deserialization under Http requests based on TcpReassembly and HttpLayer. Regardless of whether the http request package is divided into several packages, I want to deserialize a complete httpLayer object

@seladb
Copy link
Owner

seladb commented Jun 6, 2023

well, I thought about it, but didn't actually implement it yet. Currently PcapPlusPlus only supports parsing of individual packets. As a workaround you can use TCP reassembly, save the output as a packet and then parse it. But this will require some additional code

@ccworkhard
Copy link
Author

well, I thought about it, but didn't actually implement it yet. Currently PcapPlusPlus only supports parsing of individual packets. As a workaround you can use TCP reassembly, save the output as a packet and then parse it. But this will require some additional code

i'm trying to complete it. wow, Can i be a contributor?

@seladb
Copy link
Owner

seladb commented Jun 6, 2023

Yes of course! You're more than welcome to contribute to this project.

However please take into account that implementing such a feature (not the workaround I suggested) is going to be somewhat tricky...

@ccworkhard
Copy link
Author

Yes of course! You're more than welcome to contribute to this project.

However please take into account that implementing such a feature (not the workaround I suggested) is going to be somewhat tricky...

yeah, I noticed that it may need a thread pool, a buffer, file IO...
But I'll give it a try, see you next time in the PR.

@Byxs20
Copy link

Byxs20 commented Mar 4, 2024

Hopefully this feature will be available in the future, looking forward to it!

@Byxs20
Copy link

Byxs20 commented Mar 4, 2024

By the way, do you have any knowledge of projects that implement this complete HTTP request and HTTP return?

@tigercosmos
Copy link
Collaborator

seems #1212 is working on it.

@Byxs20
Copy link

Byxs20 commented Mar 5, 2024

seems #1212 is working on it.

image

Do you know a good library for parsing http like this one, not too slow?

I just need to implement this parsing of HTTP request and response packets.

The pair corresponds to 2 elements, the http request and the response.

@tigercosmos
Copy link
Collaborator

tigercosmos commented Mar 5, 2024

seems #1212 is working on it.

Do you know a good library for parsing http like this one, not too slow?

I just need to implement this parsing of HTTP request and response packets.

The pair corresponds to 2 elements, the http request and the response.

PcapPlusPlus already helps you distinguish between request and response.
If the response involves more than 1 packet, the easiest way is to concat the packets' payload by yourself. Of course, if the packets are out of order, it may be more difficult.

@seladb
Copy link
Owner

seladb commented Mar 5, 2024

By the way, do you have any knowledge of projects that implement this complete HTTP request and HTTP return?

do you need a library that parses HTTP traffic from network packets?

@Byxs20
Copy link

Byxs20 commented Mar 5, 2024

By the way, do you have any knowledge of projects that implement this complete HTTP request and HTTP return?

do you need a library that parses HTTP traffic from network packets?

I'm very targeted, it's enough to be able to handle HTTP, I don't care too much about the rest of the traffic, I've tried your project and I think I can only get the TCP data once.

@seladb
Copy link
Owner

seladb commented Mar 5, 2024

if you just need to handle HTTP traffic, you can use any web server, including those included in Python or Javascript/Typescript?

@Byxs20
Copy link

Byxs20 commented Mar 5, 2024

if you just need to handle HTTP traffic, you can use any web server, including those included in Python or Javascript/Typescript?

I mainly just need to implement parsing out a set of HTTP traffic from the traffic, containing the requested and returned data.

@Byxs20
Copy link

Byxs20 commented Mar 5, 2024

if you just need to handle HTTP traffic, you can use any web server, including those included in Python or Javascript/Typescript?

It's actually what I pictured above, and I want it returned to me in order, with the order of return determined by the precedence of the request packet.

image

@seladb
Copy link
Owner

seladb commented Mar 5, 2024

maybe you can use this library? https://github.com/hsiafan/httpdump

@Byxs20
Copy link

Byxs20 commented Mar 5, 2024

Owner

Thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants