node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

Problems with Loading File

Open mikrasov opened this issue 12 years ago • 9 comments

Hi we are trying to use the node pcap library for a network visualization project.

We got the code to run under OSX but I am having difficulty getting it to run on a Ubuntu Server 13. When we execute an live capture it works, but loading a an existing file throws a cryptic error.

Anyone have a resolution?

CODE: var pcap = require("pcap"); var pcap_session = pcap.createOfflineSession("data/eth1_eth2_20120204182604.pcap","");

ERROR:

/home/ubuntu/node_modules/pcap/pcap.js:50 me.link_type = me.session.open_offline(me.device_name, filter || "", m ^ Error: ���� at Pcap.open (/home/ubuntu/node_modules/pcap/pcap.js:50:35) at Object.exports.createOfflineSession (/home/ubuntu/node_modules/pcap/pcap.js:101:13) at Object. (/home/ubuntu/Dropbox/WWW/htdocs/cs284/test.js:3:26) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3

mikrasov avatar Nov 16 '13 18:11 mikrasov

It's hard to tell when the error message is cryptic.

ujjwalt avatar Nov 17 '13 09:11 ujjwalt

Is there any more information I can provide? Is there a specific version of libpcap that the code is known to work with?

I have a clean ubuntu 13 install with the latest nodejs and libpcap-dev available via apt-get.

The only information I could find so far was https://github.com/mranney/node_pcap/issues/71 and https://github.com/mranney/node_pcap/issues/57

Any help would be much appreciated. This is a really cool project and I would love to get it working on our server.

mikrasov avatar Nov 17 '13 17:11 mikrasov

@mikrasov Ok I'm on it. Let me have any more log files or stack traces you can put here will be helpful

ujjwalt avatar Nov 17 '13 18:11 ujjwalt

So here is the file I am trying to load http://mikrasov.com/cs284/test.pcap

So active capture seems to work fine. When running sample capture here are there first few lines

libpcap version 1.4.0 eth0 10.144.136.136/255.255.255.192fe80::2000:aff:fe90:8888/ffff:ffff:ffff:ffff:: nflog no address nfqueue no address any no address lo 127.0.0.1/255.0.0.0::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff fe:ff:ff:ff:ff:ff -> 22:00:0a:90:88:88 128.111.52.64:52445 -> 10.144.136.136:80 TCP len 60 [syn] 22:00:0a:90:88:88 -> fe:ff:ff:ff:ff:ff 10.144.136.136:80 -> 128.111.52.64:52445 TCP len 60 [ack,syn] 22:00:0a:90:88:88 -> fe:ff:ff:ff:ff:ff 10.144.136.136:37485 -> 172.16.0.23:53 DNS question 64.52.111.128.in-addr.arpa PTR

Is there any specific info I can provide? Is the 1.4 version of libpcap perhaps incompatible?

mikrasov avatar Nov 17 '13 19:11 mikrasov

I'm sorry this will take a couple of days as I'm busy. I will try to find something by 24/25th. If you can resolve this by then then please share the solution and if needed create a PR or email me a patch

ujjwalt avatar Nov 19 '13 16:11 ujjwalt

No problem,

I think the issue may be with some change in the version of libpcap. The system that has a working version reports libpcap 1.1

mikrasov avatar Nov 19 '13 17:11 mikrasov

Heya, I haven't managed to find a resolution myself. Is there any more info I can provide to be of help.

Do you happen to know how to downgrade to a working version of libpcap. There are a number of libpcap modules and I am not certain what module is used by this project.

mikrasov avatar Nov 28 '13 20:11 mikrasov

There is no particular dependency - I have libpcap 1.3.0 The error occurs at https://github.com/mranney/node_pcap/blob/master/pcap_session.cc#L219 Can't figure out what's the issue since the error message is corrupted itself. I have my exams going on so can't promise much until 9/12/2013 but I'll definitely fix this as soon as I can!

ujjwalt avatar Dec 01 '13 07:12 ujjwalt

@mikrasov Hi found any solution. If not let's hack this problem together?

ujjwalt avatar Dec 15 '13 18:12 ujjwalt