mscdex / cap

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

how it ll work from port to interface #27

Closed sandeepbs39 closed 9 years ago

sandeepbs39 commented 9 years ago

In that example program is working for interface to port 80 but i want snif the packets from port to interface is it possible?

mscdex commented 9 years ago

I'm not sure what you're asking.

sandeepbs39 commented 9 years ago

Capture and decode all outgoing TCP data packets destined for port 80 on the interface for 192.168.0.10: but i want to capture and decode all TCP packets from Port 80 to the interface 192.168.0.10

crawfordcomeaux commented 9 years ago

You can use this pcap filter: tcp src port 80 dst host 192.168.0.10

I came up with that filter by reading this: http://www.tcpdump.org/manpages/pcap-filter.7.html

mscdex commented 9 years ago

You can make sure you have the correct device opened by using the findDevice() helper and passing in the IP address of the interface. Otherwise you can use deviceList() to return a list of available devices, and pass the name you want to open(). Be aware you may need elevated privileges for this to work.

Additionally, you may need the correct filter string as @crawfordcomeaux alluded to.