Streams2 wrapper for pcap-parser.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
package.json
stream.js

README.md

pcap-stream

Streams2 wrapper for pcap-parser.

Build Status

Example

var FILE = path.join(__dirname, 'data', 'netbios-ns-b-register-winxp.pcap');

var PcapStream = require('pcap-stream');

var pstream = new PcapStream(FILE);

// read packets off manually one-by-one
pstream.on('readable', function() {
  var msg = pstream.read();
  if (msg) {
    msg.pcap.timestampSeconds === 123456;
    msg.pcap.timestampMicroseconds === 123456;
    msg.pcap.capturedLength === 76;
    msg.pcap.originalLength === 76;

    doStuff(msg.data);
  }
});
pstream.read(0);

// or pipe to another object stream for parsing, etc
var EtherStream = require('ether-stream');
var estream = new EtherStream();
pstream.pipe(estream);