Code Monkey home page Code Monkey logo

Comments (7)

simsong avatar simsong commented on May 18, 2024

It didn't used to do that. Hm...

from tcpflow.

simsong avatar simsong commented on May 18, 2024

Yes, it seems that the newly committed code doesn't unzip.

from tcpflow.

willglynn avatar willglynn commented on May 18, 2024

I didn't see unzipping in the code I stripped out. The entire HTTP scanner as of scan_http.cpp @ 2852a1 is:

if(sp.sbuf.memcmp(reinterpret_cast<const uint8_t *>("HTTP/1.1 "),0,9)==0){
    /* Looks like a HTTP response. Split it at the \r\n\r\n into two sbufs and save each */
    ssize_t body_start = sp.sbuf.find("\r\n\r\n",0);
    if(body_start==-1) return;  // no body to be found

    tcpdemux *d = tcpdemux::getInstance();

    std::stringstream xml_head;
    d->write_to_file(xml_head,sp.sbuf.pos0.path+"-HTTP",sbuf_t(sp.sbuf,0,body_start-2));

    sbuf_t sbuf_body(sp.sbuf,body_start,sp.sbuf.bufsize - body_start);
    std::stringstream xml_body;
    d->write_to_file(xml_body,sp.sbuf.pos0.path+"-HTTPBODY",sbuf_body);

    /* Need to do something with the XML */
    /* Need to handle the gzip */
}

Where did that logic live before?

from tcpflow.

willglynn avatar willglynn commented on May 18, 2024

Oh, it's in the #if 0 later in the file. I see.

Edit: it looks like process_gzip() is #if 0'd in tcpdemux.cpp as of the current master.

from tcpflow.

simsong avatar simsong commented on May 18, 2024

It was there before I did the upgrade to the bulk_extractor plug-in system. I probably forgot to re-enable it. The code works, though. We should put it back in. Do you want to handle that?

Overall, do you like the plug-in system?

from tcpflow.

willglynn avatar willglynn commented on May 18, 2024

I'll take a stab at handling gzip/deflate. I think I'll do it a little differently -- write an HTTPBODY file in all cases, but if it's a compressed Content-Encoding that we have the ability to decompress, then decompress while writing to the output file instead of writing two output files. That seems most appropriate to me; the output should correspond to HTTP payloads, regardless of how they're compressed or transmitted over the wire.

Additionally, we can at least write out to .html.gz or similar if it's gzip and decompression is disabled/unavailable.

from tcpflow.

simsong avatar simsong commented on May 18, 2024

Sounds great. I'm most appreciative!
On Nov 27, 2012, at 11:34 PM, Will Glynn [email protected] wrote:

I'll take a stab at handling gzip/deflate. I think I'll do it a little differently -- write an HTTPBODY file in all cases, but if it's a compressed Content-Encoding that we have the ability to decompress, then decompress while writing to the output file instead of writing two output files. That seems most appropriate to me; the output should correspond to HTTP payloads, regardless of how they're compressed or transmitted over the wire.

Additionally, we can at least write out to .html.gz or similar if it's gzip and decompression is disabled/unavailable.


Reply to this email directly or view it on GitHub.

from tcpflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.