2
Pcaprub installation on Win 10 x64
If you encounter the following error, the issue is pcaprub uses a hardcoded path for Winpcap. I downloaded winpcap v4.1.3 and downloaded the dev kit for Winpcap and put it in c:\WpdPack. Additionally, since I use an x64 machine I had to copy the file C:\WpdPack\Lib\x64\*.lib into C:\WpdPack\Lib and then the compilation worked.
You need pcaprub for things like msf.
C:\dev\kit>gem install pcaprub Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing pcaprub: ERROR: Failed to build gem native extension. current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pcaprub-0.13.0/ext/pcaprub_c C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20181112-2628-1wqgu6f.rb extconf.rb [*] Running checks for pcaprub_c code... platform is x64-mingw32 checking for -lws2_32... yes checking for -liphlpapi... yes checking for windows.h... yes checking for winsock2.h... yes checking for iphlpapi.h... yes checking for ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_thread_call_without_gvl()... yes checking for pcap_open_live() in -lwpcap... no checking for pcap_setnonblock() in -lwpcap... no creating Makefile current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pcaprub-0.13.0/ext/pcaprub_c make "DESTDIR=" clean current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pcaprub-0.13.0/ext/pcaprub_c make "DESTDIR=" generating pcaprub_c-x64-mingw32.def compiling pcaprub.c In file included from C:/WpdPack/include/pcap/pcap.h:41, from C:/WpdPack/include/pcap.h:45, from pcaprub.c:11: C:/WpdPack/include/pcap-stdinc.h:64: warning: "snprintf" redefined #define snprintf _snprintf In file included from C:/Ruby24-x64/include/ruby-2.4.0/ruby/ruby.h:2429, from C:/Ruby24-x64/include/ruby-2.4.0/ruby.h:33, from pcaprub.c:1: C:/Ruby24-x64/include/ruby-2.4.0/ruby/subst.h:6: note: this is the location of the previous definition #define snprintf ruby_snprintf In file included from C:/WpdPack/include/pcap/pcap.h:41, from C:/WpdPack/include/pcap.h:45, from pcaprub.c:11: C:/WpdPack/include/pcap-stdinc.h:65: warning: "vsnprintf" redefined #define vsnprintf _vsnprintf In file included from C:/Ruby24-x64/include/ruby-2.4.0/ruby/ruby.h:2429, from C:/Ruby24-x64/include/ruby-2.4.0/ruby.h:33, from pcaprub.c:1: C:/Ruby24-x64/include/ruby-2.4.0/ruby/subst.h:7: note: this is the location of the previous definition #define vsnprintf ruby_vsnprintf pcaprub.c: In function 'rbpcap_each_data': pcaprub.c:992:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] fno = (int)pcap_getevent(rbp->pd); ^ pcaprub.c:992:7: warning: assignment to 'HANDLE' {aka 'void *'} from 'int' makes pointer from integer without a cast [-W int-conversion] fno = (int)pcap_getevent(rbp->pd); ^ pcaprub.c: In function 'rbpcap_each_packet': pcaprub.c:1034:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] fno = (int)pcap_getevent(rbp->pd); ^ pcaprub.c:1034:7: warning: assignment to 'HANDLE' {aka 'void *'} from 'int' makes pointer from integer without a cast [- Wint-conversion] fno = (int)pcap_getevent(rbp->pd); ^ pcaprub.c: In function 'rbpcap_thread_wait_handle': pcaprub.c:1274:7: warning: passing argument 1 of 'rb_thread_call_without_gvl' from incompatible pointer type [-Wincompat ible-pointer-types] rbpcap_thread_wait_handle_blocking, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from pcaprub.c:4: C:/Ruby24-x64/include/ruby-2.4.0/ruby/thread.h:28:7: note: expected 'void * (*)(void *)' but argument is of type 'VALUE (*)(void *)' {aka 'long long unsigned int (*)(void *)'} void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, ^~~~~~~~~~~~~~~~~~~~~~~~~~ linking shared-object pcaprub_c.so pcaprub.o:pcaprub.c:(.text+0x1a0): undefined reference to `pcap_lib_version' pcaprub.o:pcaprub.c:(.text+0x1e0): undefined reference to `pcap_findalldevs' pcaprub.o:pcaprub.c:(.text+0x2b8): undefined reference to `pcap_freealldevs' pcaprub.o:pcaprub.c:(.text+0x32f): undefined reference to `pcap_lookupnet' pcaprub.o:pcaprub.c:(.text+0x43d): undefined reference to `pcap_close' pcaprub.o:pcaprub.c:(.text+0x45a): undefined reference to `pcap_dump_close' pcaprub.o:pcaprub.c:(.text+0x67c): undefined reference to `pcap_set_timeout' pcaprub.o:pcaprub.c:(.text+0x6ce): undefined reference to `pcap_list_datalinks' pcaprub.o:pcaprub.c:(.text+0x707): undefined reference to `pcap_datalink_val_to_name' pcaprub.o:pcaprub.c:(.text+0x76d): undefined reference to `pcap_free_datalinks' pcaprub.o:pcaprub.c:(.text+0x782): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0x828): undefined reference to `pcap_datalink_name_to_val' pcaprub.o:pcaprub.c:(.text+0x895): undefined reference to `pcap_set_datalink' pcaprub.o:pcaprub.c:(.text+0x8b3): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0x93f): undefined reference to `pcap_set_snaplen' pcaprub.o:pcaprub.c:(.text+0x9d4): undefined reference to `pcap_set_promisc' pcaprub.o:pcaprub.c:(.text+0xae1): undefined reference to `pcap_lookupnet' pcaprub.o:pcaprub.c:(.text+0xb57): undefined reference to `pcap_compile' pcaprub.o:pcaprub.c:(.text+0xb6d): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0xb9f): undefined reference to `pcap_setfilter' pcaprub.o:pcaprub.c:(.text+0xbaf): undefined reference to `pcap_freecode' pcaprub.o:pcaprub.c:(.text+0xbc1): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0xbe9): undefined reference to `pcap_freecode' pcaprub.o:pcaprub.c:(.text+0xc62): undefined reference to `pcap_compile' pcaprub.o:pcaprub.c:(.text+0xc75): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0xc9d): undefined reference to `pcap_freecode' pcaprub.o:pcaprub.c:(.text+0xccf): undefined reference to `pcap_activate' pcaprub.o:pcaprub.c:(.text+0xd33): undefined reference to `pcap_close' pcaprub.o:pcaprub.c:(.text+0xe0b): undefined reference to `pcap_close' pcaprub.o:pcaprub.c:(.text+0xe43): undefined reference to `pcap_create' pcaprub.o:pcaprub.c:(.text+0x109e): undefined reference to `pcap_close' pcaprub.o:pcaprub.c:(.text+0x110d): undefined reference to `pcap_open_live' pcaprub.o:pcaprub.c:(.text+0x129f): undefined reference to `pcap_open_offline' pcaprub.o:pcaprub.c:(.text+0x1419): undefined reference to `pcap_open_dead' pcaprub.o:pcaprub.c:(.text+0x1532): undefined reference to `pcap_dump_open' pcaprub.o:pcaprub.c:(.text+0x15d9): undefined reference to `pcap_dump_close' pcaprub.o:pcaprub.c:(.text+0x171e): undefined reference to `pcap_dump' pcaprub.o:pcaprub.c:(.text+0x17e7): undefined reference to `pcap_sendpacket' pcaprub.o:pcaprub.c:(.text+0x17fa): undefined reference to `pcap_geterr' pcaprub.o:pcaprub.c:(.text+0x18ea): undefined reference to `pcap_setnonblock' pcaprub.o:pcaprub.c:(.text+0x1912): undefined reference to `pcap_dispatch' pcaprub.o:pcaprub.c:(.text+0x19fd): undefined reference to `pcap_setnonblock' pcaprub.o:pcaprub.c:(.text+0x1a25): undefined reference to `pcap_dispatch' pcaprub.o:pcaprub.c:(.text+0x1b35): undefined reference to `pcap_getevent' pcaprub.o:pcaprub.c:(.text+0x1be3): undefined reference to `pcap_getevent' pcaprub.o:pcaprub.c:(.text+0x1c91): undefined reference to `pcap_datalink' pcaprub.o:pcaprub.c:(.text+0x1cdc): undefined reference to `pcap_major_version' pcaprub.o:pcaprub.c:(.text+0x1d27): undefined reference to `pcap_minor_version' pcaprub.o:pcaprub.c:(.text+0x1d72): undefined reference to `pcap_snapshot' pcaprub.o:pcaprub.c:(.text+0x1dca): undefined reference to `pcap_stats' collect2.exe: error: ld returned 1 exit status make: *** [Makefile:259: pcaprub_c.so] Error 1 make failed, exit code 2 Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/pcaprub-0.13.0 for inspection. Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/pcaprub-0.13.0/gem_make.out
This solution has been deemed correct by the post author
Please help me I have a same problem mentioned above
Was this answer helpful?
LikeDislikeThanks, this will be tracked upstream in https://github.com/pcaprub/pcaprub/issues/55
Was this answer helpful?
LikeDislike