Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hdrgrabpublic

    hdrgrab

    hdrgrab sniffs HTTP messages off the wire and writes them into a HAR file.

    Installing hdrgrab

    First you'll need Node and its package manager, npm.

    Then, hdrgrab can be installed with npm like this:

    sudo npm -g install hdrgrab

    which will install dependencies automatically.

    Under the covers, hdrgrab relies upon node_pcap and optimist.

    Using hdrgrab

    hdrgrab

    Start it up like this:

    hdrgrab

    which will sniff on port 80 and output to "grab.har".

    hdrgrab -o foo.har

    will output to the file "foo.har"

    hdrgrab -p 8000

    will sniff on port 80.

    On some operating systems, you may need to specify the interface to listen on. For example:

    hdrgrab -p 8000 -i eth0

    and in some cases, you may need permission to listen to the device, making the appropriate command line something like:

    sudo hdrgrab -p 8000 -i eth0 -o foo.har

    Installation Problems?

    libpcap

    If npm complains about problems with pcap, like this:

    npm ERR! Failed at the pcap@0.2.7 install script.
    

    it usually means that it couldn't find libpcap when building. See the instructions here: https://github.com/mranney/node_pcap.

    On my OSX machine, I have to build like this (becoming root first):

    CXXFLAGS=-I/opt/local/include npm -g install hdrgrab

    because my pcap headers are in a non-standard place (thanks to MacPorts). YMMV.

    Contact

    Mark Nottingham mnot@mnot.net

    http://github.com/mnot/hdrgrab/

    Keywords

    none

    install

    npm i hdrgrab

    Downloadslast 7 days

    1

    version

    0.2.1

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar