libpcap

android use pcap library

陌路散爱 提交于 2019-12-05 00:51:46
问题 I have a general question according an android app, I need to use some pcap functionality in my android app. Because java does not give the possibility in raw packet injections and low layer programming (as far as I know, pls correct me if I'm wrong) so I was looking for an alternative. So far I found the following: ANDROID NDK JNETPCAP Any suggestions which one I should use or does anyone have other suggestions? 回答1: The JNI Solution You need to wrap the calls and the logic you need out of

How to perform scanning of wifi ap available nearby using pcap in c [closed]

前提是你 提交于 2019-12-04 22:09:57
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Basically I want a simple C code which illustrates capturing packet in promiscuous mode and extracts out ssid from them. Edit1 I am writing the code which I wrote to perform basic sniffing. #include <stdio.h> #include <pcap.h> int main(int argc, char *argv[]){ pcap_t *handle; struct pcap_pkthdr header; const u_char *packet; int i; char *dev, errbuf[PCAP_ERRBUF_SIZE]; // dev = pcap_lookupdev(errbuf); dev = argv[1

Raw Socket Sniffing in Golang

笑着哭i 提交于 2019-12-04 00:45:51
I have a question concerning tcp packet sniffing with golang. We have written a small tool which captures all incoming TCP packets comming from a fibre Tap. The current implementation uses a libpcap wrapper under Linux. We need to port this tool to Windows. Of course, it is not possible at the moment. So my question is, is there a cross platform solution for sniffing packets? We only need TCP packets, IP headers , no Ethernet Data and not all features of libpcap. If there is no cross platform solution, two Code implementation would be ok, too. I know one can use raw sockets under Linux (and

android use pcap library

徘徊边缘 提交于 2019-12-03 17:24:26
I have a general question according an android app, I need to use some pcap functionality in my android app. Because java does not give the possibility in raw packet injections and low layer programming (as far as I know, pls correct me if I'm wrong) so I was looking for an alternative. So far I found the following: ANDROID NDK JNETPCAP Any suggestions which one I should use or does anyone have other suggestions? The JNI Solution You need to wrap the calls and the logic you need out of libpcap in C or C++ and expose the underlying functions through JNI (Java Native Interface) so your

libpcap or PF_PACKET?

ぃ、小莉子 提交于 2019-12-03 16:55:24
I understand this question has been discussed many times: Should I use libpcap or PF_PACKET (the data link socket) to capture packets? Based on my research, libpcap is suggested over PF_PACKET almost everywhere, mainly due to its portability. However, for my current project (which is used in a production system), portability is not a concern at all, all I care about is performance (speed, packet loss ratio). My program is running on CentOS 5.10 (kernel 2.6.18) As far as I know, libpcap put a timestamp on each packet. Does this cause big performance loss? Are there other factors that make

set a filter of packet length in wireshark

谁都会走 提交于 2019-12-03 08:16:44
问题 I've capture a pcap file and display it on wireshark. I want to analysis those udp packets with 'Length' column equals to 443. On wireshark, I try to found what's the proper filter. udp && length 443 # invalid usage udp && eth.len == 443 # wrong result udp && ip.len == 443 # wrong result By the way, could the wireshark's filter directly apply on libpcap's filter? 回答1: All these workable on wireshark's filter frame.len==243 <- I use this ip.len=229 udp.length==209 data.len=201 来源: https:/

parse IP and TCP header (especially common tcp header options)of packets captured by libpcap

走远了吗. 提交于 2019-12-03 07:50:38
问题 I want to use libpcap to capture IP packet, and the I want to parse the IP header and tcp header. ` there are IP header and TCP header structures in <netinet/ip.h> and <netinet/tcp.h> IP header is relatively easier to parse, but for TCP header,since there are tcp options, the common options are MSS, SACK(selective acknowledgement), timestamp, window scaling and NOP. I want to have a function parse_pkt(): struct tcphdr tcp_hdr; struct ip ip_hdr; parse_pkt(u_char *pcap_packet, struct ip* p_ip,

Does libpcap use raw sockets underneath them?

痞子三分冷 提交于 2019-12-03 06:47:43
I was getting a bit confused on using of raw sockets and libcap. Can, anyone in simple point out advantages of using both. I read few links, but, its making me confused. "libpcap" and "raw sockets" are different topics. Libpcap is a packet capture library for linux which is used to capture the traffic/packets that pass through a network interface like eth0. On windows the Winpcap library does the same thing. Raw sockets are a feature of the socket api provided by the OS that can be used to send packets with headers defined by the application and not the OS. So using raw sockets we can specify

pcap_dispatch - callback processing questions

冷暖自知 提交于 2019-12-03 06:20:54
问题 I am writing fairly simply pcap "live" capture engine, however the packet processing callback implementation for pcap_dispatch should take relatively long time for processing. Does pcap run every "pcap_handler" callback in separate thread? If yes, is "pcap_handler" thread-safe, or should the care be taken to protect it with critical sections? Alternatively, does pcap_dispatch callback works in serial fashion? E.g. is "pcap_handler" for the packet 2 called only after "pcap_handler" for packet

libpcap to capture 10 Gbps NIC

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to capture packets from 10Gbps network card with 0 packet loss. I am using lipcap for 100Mbps NIC and it is working fine. Will libpcap be able to handle 10Gbps NIC traffic? If not what are the other alternative ways to achive this? 回答1: Whether or not libpcap will handle 10Gbps with 0 packet loss is a matter of the machine that you are using and libpcap version. If the machine, CPU and HDD I/O are fast enough, you may get 0 packet loss. Otherwise you may need to perform the following actions: Update your libpcap to the most recent