libpcap

Asynchronous libpcap: losing packets?

吃可爱长大的小学妹 提交于 2019-12-01 02:51:17
问题 I have a program that sends a set of TCP SYN packets to a host (using raw sockets) and uses libpcap (with a filter) to obtain the responses. I'm trying to implement this in an asynchronous I/O framework, but it seems that libpcap is missing some of the responses (namely the first packets of a series when it takes less than 100 microseconds between the TCP SYN and the response). The pcap handle is setup like this: pcap_t* pcap = pcap_open_live(NULL, -1, false, -1, errorBuffer); pcap

Compile libpcap using Android NDK

本秂侑毒 提交于 2019-11-30 23:19:18
I've been doing a lot of attempts to get libpcap compiled for Android, and I don't see any pattern or any progress worth writing down. I have a very simple sniffer (that works fine in a MIPS linux) that uses libpcap, so I thought to myself oh, ok... no biggie... I'll just compile libpcap for Android (in the end, Android is just a Linux)... and here's where the problems started. I have no idea on how to compile libpcap using ndk-build and the Android.mk and all that infrastructure. I have the Android NDK in a directory. That NDK has the toolchains built (I have a lot of directories under ~

Compile libpcap using Android NDK

泪湿孤枕 提交于 2019-11-30 18:48:22
问题 I've been doing a lot of attempts to get libpcap compiled for Android, and I don't see any pattern or any progress worth writing down. I have a very simple sniffer (that works fine in a MIPS linux) that uses libpcap, so I thought to myself oh, ok... no biggie... I'll just compile libpcap for Android (in the end, Android is just a Linux)... and here's where the problems started. I have no idea on how to compile libpcap using ndk-build and the Android.mk and all that infrastructure. I have the

Android NDK: Trying to port JnetPcap

社会主义新天地 提交于 2019-11-30 15:25:34
I found a traffic monitoring application for Android, Shark: http://sourceforge.net/projects/prueba-android/ which is based on JnetPcap and has a file with all the source files and the appropriate Android.mk files. I put the jni directory in the samples file of the Android-NDK and I tried to build it using ndk-build -C. During the compilation occurs some errors. Here is the error log I take: make: Entering directory `/home/thanasis/android-ndk-r5b/samples /jnetpcap_pure/jni' Compile thumb : jnetpcap <= util_crc16.c Compile thumb : jnetpcap <= util_crc32.c Compile++ thumb : jnetpcap <= jnetpcap

Creating a pcap file

与世无争的帅哥 提交于 2019-11-30 09:55:26
I need to save UDP packets to a file and would like to use the pcap format to reuse the various tools available (wireshark, tcpdump, ...). There are some information in this thread but I can't find how to write the global file header 'struct pcap_file_header'. pcap_t* pd = pcap_open_dead(DLT_RAW, 65535); pcap_dumper_t* pdumper = pcap_dump_open(pd, filename); struct pcap_file_header file_hdr; file_hdr.magic_number = 0xa1b2c3d4; file_hdr.version_major = 2; file_hdr.version_minor = 4; file_hdr.thiszone = 0; file_hdr.sigfigs = 0; file_hdr.snaplen = 65535; file_hdr.linktype = 1; // How do I write

Is there any way to put Android WIFI (droid handset) into promiscuous monitoring mode?

吃可爱长大的小学妹 提交于 2019-11-30 05:19:52
For a Computer Science Information Warfare class a few years ago I wrote a python script that ran on libpcap promiscuous packet capture files to parse out facebook chat traffic (earlang tuples passed in clear text), and thought an interesting project would be to port the program to Android. I would like to rewrite it in Java but can't find any information about packet capturing directly on the handset. As far as I'm aware, there is no way to put the Wifi NIC into monitoring mode from the public API. However, depending on the device used by the phone, you may be able to get the system to put it

Creating a pcap file

跟風遠走 提交于 2019-11-29 15:34:17
问题 I need to save UDP packets to a file and would like to use the pcap format to reuse the various tools available (wireshark, tcpdump, ...). There are some information in this thread but I can't find how to write the global file header 'struct pcap_file_header'. pcap_t* pd = pcap_open_dead(DLT_RAW, 65535); pcap_dumper_t* pdumper = pcap_dump_open(pd, filename); struct pcap_file_header file_hdr; file_hdr.magic_number = 0xa1b2c3d4; file_hdr.version_major = 2; file_hdr.version_minor = 4; file_hdr

ctypes and passing a by reference to a function

寵の児 提交于 2019-11-29 04:29:23
I'm trying to use libpcap in python3 using ctypes. given the following function in C pcap_lookupnet(dev, &net, &mask, errbuf) in python I have the following pcap_lookupnet = pcap.pcap_lookupnet mask = ctypes.c_uint32 net = ctypes.c_int32 if(pcap_lookupnet(dev,net,mask,errbuf) == -1): print("Error could not get netmask for device {0}".format(errbuf)) sys.exit(0) and the error i get is File "./libpcap.py", line 63, in <module> if(pcap_lookupnet(dev,net,mask,errbuf) == -1): ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2 how do you deal with &blah

Is there any way to put Android WIFI (droid handset) into promiscuous monitoring mode?

懵懂的女人 提交于 2019-11-29 03:31:40
问题 For a Computer Science Information Warfare class a few years ago I wrote a python script that ran on libpcap promiscuous packet capture files to parse out facebook chat traffic (earlang tuples passed in clear text), and thought an interesting project would be to port the program to Android. I would like to rewrite it in Java but can't find any information about packet capturing directly on the handset. 回答1: As far as I'm aware, there is no way to put the Wifi NIC into monitoring mode from the

Parsing WiFi Packets (libpcap)

允我心安 提交于 2019-11-28 18:53:42
I've been working on a way to have an OpenWRT router log WiFi probe requests to a MySQL db (it stores MAC address and RSSI info for each probe request packet along with other, router-specific data). After researching libpcap quite a bit, I've been able to cobble together a basic little program that simply sniffs packets on a monitor interface (mon0) using a filter expression ('wlan subtype probe-req') and then prints out the raw packets in hex. With the info that's available online on libpcap this part was fairly straightforward. Now here's where I'm stuck: How do I parse the WiFi packet to