Nmap Development mailing list archives

Re: PCAP Timeout issue


From: 食肉大灰兔V5 <hsluoyz () gmail com>
Date: Thu, 11 Feb 2016 00:56:52 +0800

Hi Tenzin,


On Fri, Feb 5, 2016 at 2:38 AM, Tenzin Rigden <tenzin.rigden33 () gmail com>
wrote:

Hello,

I contacted you earlier about the PCAP timeout issue I was having. My
issue where I only get PCAP timeouts occurs even when I am still connected
to to Internet. I didn't realize there was a dev list, but I will contact
you through here from now on.

The timeout duration can be set by `pcap_set_timeout(pcap_t*, int)`
function.
It's unclear what the default value is, according to this
http://www.tcpdump.org/manpages/pcap_set_timeout.3pcap.html.


From the WinPcap/Npcap source, it seems that the default value is 0.



My program itself is actually written in Rust and I use this pcap library
https://github.com/ebfull/pcap, which interfaces between rust and C, so I
don't have a visual studio project for that to share.
One thing I failed to mention in my first email is that my issue seems to
be more frequent when I try to run my program as a windows service that
runs my program as a Process object in C sharp.

Regardless, I'm trying to recreate this by creating a small VS C++
project, but I'm running into difficulty in just using building a basic
program using the headers.
I'm using the "PACKET DUMP" sample program from the WinPcap documentation
here, http://www.winpcap.org/docs/docs_412/html/group__wpcapsamps.html.

And I collected all my header files from your npcap repo,
https://github.com/nmap/npcap/tree/master/wpcap/libpcap/pcap.


Actually Npcap shares exactly the same libpcap API with WinPcap. So you
don't need to build against Npcap source. Using WinPcap 4.1.2 Developer's
Pack (here: https://www.winpcap.org/devel.htm) is just fine. If you
installed Npcap, your code will just automatically invoke Npcap's functions.



I attempted to make a few edits to get it to compile (adding absolute
paths to the includes for header files, and adding a typedef uint u_int for
all of the u_*types*), but I still have a few errors I can't seem to figure
out. I also don't know where to find the "pcap-stdinc.h" file.


pcap-stdinc.h is in both WinPcap 4.1.2 Developer's Pack and Npcap source.
See:

WinPcap 4.1.2 Developer's Pack: **\WpdPack_4_1_2\Include\pcap-stdinc.h
Npcap source: **\npcap\wpcap\libpcap\pcap-stdinc.h



I have attached this VS project below.


I have fixed the compiling errors of your project. See attached.
I had modified the VC++ Directories to add WinPcap 4.1.2 Developer's Pack.
Make sure your WinPcap 4.1.2 Developer's Pack is in
path: G:\lib\WpdPack_4_1_2 (or change my settings).


Cheers,
Yang




Thank you for taking the time to look at this.


--
Tenzin Rigden

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Attachment: Win32Project1_fixed.zip
Description:

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: