Multiple device selection on none Linux systems.
I would like to suggest a feature request. Like you said in an other issue the any device is part of libpcap but only on Linux systems, so I would be great if it would be possible to specify more devices on startup to capture from.
Hi @dunst0
As far as I know, there is no easy way to listen on multiples interfaces with libpcap. I think most of the network sniffers based on libpcap doesn't allow multiples interfaces (tcpdump, ngrep, and so) and I am not totally sure if it is Thread-Safe (as we should launch a thread for each capturing interface). Using multiple child process won't work with sngrep design.
Not an elegant workaround, but If you have the need to capture in multiples interfaces, you can use hep/eep to run two different sngrep (one without showing interface) and send captured data from one sngrep to another.
sngrep -Hudp:127.0.0.1:9999 -d eth0 -Nq
sngrep -Ludp:127.0.0.1:9999 -d eth1
If you find a way to do this or other tool implementing multiple interface capture with libpcap, don't hesitate to comment it :)
I found some information regarding pcap and multi device caputuring.
Maybe it helps: http://seclists.org/tcpdump/2012/q2/18
Hii,
After a year... I have created a branch called multi_device that implements support for multiple -d command line options so multiple capture devices can be now specified.
This requires a lot of testing, just to be sure that all shared structures are properly locked and no memory is now accessed/free'd at the same time from multiple capture threads.
I think someone in the IRC was also interested in this feature, so all the testing is appreciated.
Best regards!
I will merge this into master and wait for a bit of testing before releasing :)
This should be supported in 1.4.3
As always, feel free to reopen if it doesn't work as expected and will try to fix it for the next release!
Hi @Kaian I haven't checked for some time the messages in github, so I missed some of your messages. Great to hear that there is now multiple devices. Many thanks to you for implementing that feature and thank you for developing and maintaining that great tool.
Just to let you know, seem that with multi it seems that on FreeBSD I receive ever package double or they are displayed double.
You mean using a single interface in the command line? :thinking:
It seems that with 1.4.3 every package has a retransmission, maybe not a problem from multi interface.
17:45:16.353595 │ ─────── INVITE (SDP) ─────> │
17:45:16.353595 │ ─────── INVITE (SDP) ───>>> │
17:45:16.355355 │ <─────── 100 Trying ─────── │
17:45:16.355355 │ <<<───── 100 Trying ─────── │
17:45:16.932852 │ <─────── 180 Ringing ────── │
17:45:16.932852 │ <<<───── 180 Ringing ────── │
17:45:44.644340 │ ────────── CANCEL ────────> │
17:45:44.644340 │ ────────── CANCEL ──────>>> │
17:45:44.645274 │ <────── 200 canceling ───── │
17:45:44.645274 │ <<<──── 200 canceling ───── │
17:45:44.882831 │ <──── 487 Request Termi ─── │
17:45:44.882831 │ <<<── 487 Request Termi ─── │
17:45:44.883180 │ ──────────── ACK ─────────> │
17:45:44.883180 │ ──────────── ACK ───────>>> │
it doesn't matter if do sngrep -d em0 or sngrep -d em0 -d lo0
Does this happen when you capture a pcap file with tcpdump or ngrep and open it in sngrep?
Yes even when I capture a file with tcpdump and just open it with sngrep
Then the final test will be checking if the pcap file contains duplicate packets inside. If so, then the problem must be in the interface or libpcap (as all that capture tools use the same library to capture). If packets only appear once in the file and sngrep display them twice, then I must dig a bit more :thinking:
We've using sngrep 1.4.3 since May, but only in debian based systems.. :S
Wireshark doesn't show up resends in the call flows. :flushed:

Hmmm.. could you send me a sample pcap to check its contents?
I don't think wireshark has some duplicated packets removal logic, but I don't know tbh. It's using the same libpcap version that the machine capturing? You can also check if content are duplicated in the capturing maching by running tcpdump -r your.pcap -A and check if packets seems duplicated.
Thanks for the testing!
For that I have to create a filter and the problem is the pcap may contains telephone numbers from customers if I doesn't filter it correct, that will be work for tomorrow. I will try to make a pcap. Btw with tcpdump the 180 Ringing isn't displayed multiple times.
If you're compiling from sources, you also have a test pcap in tests/aaa.pcap to give it a try :smile:
With tests/aaa.pcap the packets are show double as well 😢
Could you give it a try to latest commits to check if somehow the error still persist? If that's the case then I should not release 1.4.4 :sweat_smile:
Thanks @dunst0 !