node_pcap
node_pcap copied to clipboard
packet.link.ip or packet.payload.payload?
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.
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