libpcap

Processing incorrect mac addresses from 802.11 frames with pcap

ⅰ亾dé卋堺 提交于 2019-12-06 10:17:04
I'm working throurgh a project with pcap and wireless. Following an example posted in response to oe of my earlier questions I am trying to extract the mac addresses from wireless frames. I have created structures for the radiotap header and a basic management frame. For some reason when it comes to trying to output the mac addresses I am printing out the wrong data. When I compare to wireshark I don't see why the radio tap data is printing out correctly but the mac addresses are not. I don't see any additional padding in the hex dump that wireshark displays when i look at the packets and

How to sniff all packets on python when scapy and pypcap have serious loss?

时光毁灭记忆、已成空白 提交于 2019-12-06 09:56:54
问题 I tried to sniff packets on Win10 using python. However, i find a lot of packets are actually dropped by scapy. For example, I download a file of 2 MB from ftp, the wiresharks captures nearly 2000 packets and the scapy only captures 500. I have tried pypcap and the result is almost the same, more than half of the packets are dropped, especially on downloading. Is there a solution to avoid such loss and make scapy perform the same as wireshark, or there is no library on python capable of

Linux: How to send a whole packet to a specific port on another host?

耗尽温柔 提交于 2019-12-06 05:27:31
I have captured a TCP packet using libpcap, and I want to send this whole packet(without modifying it) to a specific port on another host(which has another sniffer listening to that port). Is there any way I can do this? Thanks a lot! m0skit0 You didn't specify which programming language you're using and what you've tried so far. Change the IP address field to the target IP and the TCP port field to the port you want. Don't forget to update both checksums. If what you want is TCP forwarding, the Linux kernel already does this for you . Chris Hinshaw netcat may work in this case although I

Why is pcap_datalink() always returning 1 (Ethernet), even on wireless device?

泪湿孤枕 提交于 2019-12-05 17:16:00
I'm having an issue where by pcap_datalink() is always returning 1 . To my understanding this is LINKTYPE_ETHERNET . But, the device I am using is a wireless card and in my case en0 . This is stopping me from putting the card into monitor mode, and stopping my WLAN filters from working. I've tried to run this on both OSX and Linux with the same results. I also run as root. Here's the part of my code that's causing the problem. For the example, assume dev is set to en0 (wireless device on Mac). #include <stdio.h> #include <pcap.h> #include <stdlib.h> int main(int argc, char *argv[]) { pcap_t

Can I use pcap library for receiving ipv6 packets?

随声附和 提交于 2019-12-05 16:35:01
I am trying to convert hping3 to hping6. hping3 uses Pcap library to receive IPv4 packets. But I need to receive IPv6 packets. That is possible. libpcap is able to catch anything on the wire. Example using ETHERTYPE_IPV6 : static u_int16_t ether_packet(u_char *args, const struct pcap_pkthdr *pkthdr, co nst u_char *p) { struct ether_header *eptr = (struct ether_header*)p; assert(pkthdr->caplen <= pkthdr->len); assert(pkthdr->caplen >= sizeof(struct ether_header)); return eptr->ether_type; } // This is the callback. assumes ethernet frame. static void pcap_callback(u_char *args,const struct pcap

Raw Socket Sniffing in Golang

霸气de小男生 提交于 2019-12-05 14:54:52
问题 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

Sniffing wifi using libpcap in monitor mode

喜欢而已 提交于 2019-12-05 07:59:12
Problem Statement Calling pcap_activate() results in PCAP_ERR_RFMON_NOTSUP error, i.e. RF monitor mode is not supported. Context I'm writing small C program whose job is to listen on my laptop's wifi card in monitor mode. The laptop is running Ubuntu 12.04 LTS. I ran airmon-ng start wlan0 command after which mon0 interface appeared. Following shows output of iwconfig command after running the airmon command: $ iwconfig mon0 IEEE 802.11bgn Mode:Monitor Tx-Power=16 dBm Retry long limit:7 RTS thr:off Fragment thr:off Power Management:off eth0 no wireless extensions. lo no wireless extensions.

help installing libpcap on cygwin

梦想与她 提交于 2019-12-05 03:00:23
问题 i was trying to install libpcap under cygwin on windows 7 but i had this error: $ ./configure . . . . . configure: error: see the INSTALL for more info how can i solve this? i am using libpcap-1.0.0 which is the latest version. 回答1: I know this is a late reply, but I just went through the same install issues on Windows 7. On Windows, you should use Winpcap: http://www.winpcap.org/ 回答2: http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_install_Winpcap_/_Libpcap_under_Cygwin libpcap

Order of sending “Frame Control field”data of an 802.11 frame?

独自空忆成欢 提交于 2019-12-05 01:53:59
问题 Below is bit format for FC field for QoS Data: 00|01|0001 01000010 The first 2 bits represent version, the next 2 bits type, the next 4 bits subtype, with ToDS=0, FromDS=1,Protection bit=1. So, in what order is the above data sent through the interface on the air? (i.e left to right or right to left ) I see the wireshark catching the data as " 8842 "(in the last segment where it shows raw packet data). But, if I write the following code to print FC field data: struct mgmt_header_t { u_int16_t

libpcap or PF_PACKET?

▼魔方 西西 提交于 2019-12-05 01:14:45
问题 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