node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

packet.link.ip or packet.payload.payload?

Open cyphunk opened this issue 9 years ago • 1 comments

The documentation is getting a bit confusing for me.

Around v1.2.0 this would work:

    var packet = pcap.decode.packet(raw_packet);
    console.log(packet.link.ip.tcp.dport);

However this doesn't appear to be the case any more in v2+? The README.md however still references this method of use. It would help if the documentation in the README.md matched the code, or if not that then just removing the stale parts would help.

cyphunk avatar Jan 29 '16 15:01 cyphunk

I have found the same behavior and had to dive into three layers of 'payload'.

var packet = pcap.decode.packet(raw_packet);
console.log(packet.payload.payload.payload);

This seems to be a vector to introduce errors since we would have to inspect the resulting object for expected elements

My guess is this has to do with the work noted here: https://github.com/node-pcap/node_pcap/blob/master/README.md

ki4rbc avatar Sep 01 '17 17:09 ki4rbc