mscdex / cap

A cross-platform binding for performing packet capturing with node.js
MIT License
361 stars 45 forks source link

DNS Sniffing? #45

Closed sascha1337 closed 8 years ago

sascha1337 commented 8 years ago

Checking your sourcecode, i did not find any DNS parsing, is this on roadmap or won't be implemented? Trying to put buffer from 53' packet into https://github.com/mdns-js/node-dns-js doesn't work :/

mscdex commented 8 years ago

DNS can be quite complex, there are no plans right now to add a parser for that. However, it should be enough to use code similar to that in the example in the readme, where you "strip" the Ethernet and UDP layers and then pass the relevant slice of the buffer to whatever DNS parser you want. So after decoding the UDP packet, the entire UDP payload would be buffer.slice(ret.offset, ret.offset + ret.info.length).

sascha1337 commented 8 years ago

its working, thank you for that hint with buffer.slice !