Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by src host and length #230

Open
ghost opened this issue Jul 29, 2017 · 0 comments
Open

Filter by src host and length #230

ghost opened this issue Jul 29, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 29, 2017

Hi, I am trying to filter the traffic using this syntax but it's throwing me an error when I try to run it.

const interface = 'en0';
let filter = 'src host xxx.xx.xx.xx \\udp';
const pcap = require('pcap'),
  pcap_session = pcap.createSession(interface, filter);


pcap_session.on('packet', function (raw_packet) {
  let packet = pcap.decode.packet(raw_packet);
  console.log(packet);
  console.log('======================');
});

This error :

this.link_type = this.session.open_live(this.device_name, this.filter, this.buffer_size, this.outfile, packet_ready, this.is_monitor);
Error: syntax error in filter expression: syntax error

I've looked at the man of pcap-filter and they say :

src host host
True if the IPv4/v6 source field of the packet is host.

Have I done something wrong ? or how can I only listen to udp package where the src host is a specific id ?

NB: I also try to add a "greater 1200" in the filter but it gives me a syntax error as well. How can I do that ?

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants