Questions tagged [libpcap]

Libpcap, a portable C/C++ library for network traffic capture. Provides a common interface across various OS-specific backends like BPF, packet filter, netfilter, and NPF.

Libpcap was originally developed by the tcpdump developers in the Network Research Group at Lawrence Berkeley Laboratory. The low-level packet capture, capture file reading, and capture file writing code of tcpdump was extracted and made into a library, with which tcpdump was linked.

796 questions
0
votes
1 answer

Receiving TCP segments bigger than MTU with libpcap

Hello fellow network adventurers, I'm implementing a network attack, which ARP spoofs a gateway and a victim, filters the HTTP data and reassemble the web pages in my browser. Also known as webspy. However, I'm having some issues with libpcap. When…
rodopoulos
  • 13
  • 6
0
votes
1 answer

Error with attribute in libpcap

I'm using the code from here to for 802.11 sniffing in monitor mode. #define ETH_HEADER_SIZE 14 #define AVS_HEADER_SIZE 64 /* AVS capture header size */ #define DATA_80211_FRAME_SIZE 24 /* header for 802.11 data packet…
Bobo
  • 941
  • 2
  • 11
  • 19
0
votes
1 answer

C: libpcap doesn't capture wlan0 packets

I'm new in C and got little confused. I've read some topics about this problem but none of them worked for me. I'm trying to capture wlan0 packets with libpcap but something goes wrong. pcap_next() function returns null but i can't figure out why.…
Ojs
  • 924
  • 1
  • 12
  • 26
0
votes
2 answers

How do I get packet length and ip addresses in libpcap

From this example void process_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *buffer) { int size = header->len; //Get the IP Header part of this packet , excluding the ethernet header struct iphdr *iph = (struct…
Bob
  • 383
  • 1
  • 5
  • 16
0
votes
1 answer

net/raw.h No such file or directory while compiling Android PCAP (jnetpcap) with NDK r10e

I am trying to learn Android-NDK, so i am trying to modify existing examples so I am trying to build apk from Android-PCAP but unable to do so, and getting this error message Information:Gradle tasks [:app:assembleDebug] WARNING [Project:…
DeepSidhu1313
  • 805
  • 15
  • 31
0
votes
1 answer

Libpcap filter strings using "vlan" are behaving weirdly

I am getting some weird errors when using libpcap pcap_compile Please let me know if these are known issues or I am making some bpf formating/ordering mistakes For example: 1) if I pass (protocol_filter and vlan_filter), I see no packets: Like…
user3851499
0
votes
1 answer

Querying Interfaces to find device with libpcap

Ok, so I have systems that could be plugged up to any number of ethernet ports on the target computer. My goal was to loop through each device, collect around ~20 packets, or if it's getting no data then skip it, until I found the data I was looking…
AMB0027
  • 121
  • 12
0
votes
1 answer

Writing pcap packets into a structure with libpcap

I have a pcap file captured by wireshark, now I need to read each packet of it and write them to a vector of structure. I got some promblem with writing packets into the structure. the structure: struct pktStruct { struct pcap_pkthdr *…
wangx1ng
  • 73
  • 1
  • 2
  • 10
0
votes
1 answer

pcap_dispatch() always returns 0 on Mac OSX for wifi interface

I have few devices connected to wifi router, but pcap_dispatch() always returns 0 for wifi interface while live capturing on Mac OS X. The same code captures response in case of wired interface. Please clarify if I have missed any flag here.
Balaji M
  • 3
  • 1
0
votes
2 answers

Merging two pcap files with libpcap

I already know how to read a pcap file and get the packets it have.B ut how can I write the packets into a new pcap file? I need this to merge two pcap files into one.
wangx1ng
  • 73
  • 1
  • 2
  • 10
0
votes
1 answer

Libpcap not capturing any interface on android device

I am trying to make a packet sniffing Application and I had build it as a system Application for nexus 4. r = pcap_findalldevs (&alldevs, errbuf); printf("R==========%d",r); __android_log_write(ANDROID_LOG_ERROR, "Tag",errbuf ); error is E/Tag…
0
votes
1 answer

Capture Packet Dump from a Specific Domain

I am working on a Deep Packet Inspection project of my own. In order to test this, I need https/ssl packet dump from a specific site. As an example I want to capture all the packets transmitted during a Facebook session. I tried wire-shark but I…
user2389323
  • 769
  • 2
  • 10
  • 22
0
votes
2 answers

capture traffic from emulator to a server on the same machine

I am trying to capture http traffic using pcap4j from an android emulator / ios simulator to a server which is hosted on the same machine. The machine can run either linux / windows or osx. I tried capturing packets from wireshark first for testing,…
barisdad
  • 515
  • 7
  • 19
0
votes
1 answer

pcap_lookupdev function not work in qt

My Code is below : #include #include #include int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); char error_buffer[PCAP_ERRBUF_SIZE]; char *s; …
0
votes
1 answer

How to use pcap_stats in libpcap?

I added the following function to the sniffex code (http://www.tcpdump.org/sniffex.c): typedef struct pcap_stat mystat; mystat *mystatp; /* Put the interface in statstics mode */ if(pcap_stats(handle, mystatp) < 0) { fprintf(stderr,"\nError…
dev
  • 11,071
  • 22
  • 74
  • 122