diff --git a/main.cpp b/main.cpp index 6743d76..133abb9 100755 --- a/main.cpp +++ b/main.cpp @@ -668,8 +668,10 @@ void async_cb(struct ev_loop *loop, struct ev_async *watcher, int revents) memcpy(pcap_header_buf,p,pcap_link_header_len); log_bare(log_info,"link level header captured:\n"); + unsigned char *tmp=(unsigned char*)pcap_header_buf; for(int i=0;i",(u32_t)(unsigned char)pcap_header_buf[i]); + log_bare(log_info,"<%x>",(u32_t)tmp[i]); + log_bare(log_info,"\n"); return ; } @@ -787,7 +789,7 @@ int client_event_loop() { mylog(log_info,"--dev have not been set, trying to detect automatically, avaliable deives:\n"); - mylog(log_info,"avaliable deives(and ip address):\n"); + mylog(log_info,"avaliable deives(device name: ip address ; description):\n"); char errbuf[PCAP_ERRBUF_SIZE]; @@ -816,7 +818,12 @@ int client_event_loop() } } } - if(cnt==0) log_bare(log_info," (no ip found)"); + if(cnt==0) log_bare(log_info," [no ip found]"); + if(d->description==0) + { + log_bare(log_info,"; (null)"); + } + log_bare(log_info,"; %s", d->description); log_bare(log_info,"\n"); } diff --git a/pcap_wrapper.cpp b/pcap_wrapper.cpp index f4ccee5..3b7c005 100644 --- a/pcap_wrapper.cpp +++ b/pcap_wrapper.cpp @@ -1,7 +1,7 @@ #include #include #include - +#include int (*pcap_loop )(pcap_t *, int, pcap_handler, u_char *); pcap_t* (*pcap_create)(const char *, char *); @@ -43,6 +43,11 @@ struct init_pcap_t int init_pcap() { HMODULE wpcap=LoadLibrary("wpcap.dll"); + if(wpcap==0) + { + printf("cant not open wpcap.dll, make sure winpcap/npcap is installed\n"); + exit(-1); + } assert(wpcap!=0); pcap_loop = (__typeof__(pcap_loop))GetProcAddress(wpcap, "pcap_loop");