1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-04-12 04:12:05 +02:00

38 lines
1.1 KiB
Diff

--- pcap-linux.c 2010-03-11 17:56:54.000000000 -0800
+++ /opt/libpcap-1.1.1/pcap-linux.c 2014-07-11 13:18:06.133832775 -0700
@@ -3378,6 +3378,9 @@
unsigned int tp_snaplen;
unsigned int tp_sec;
unsigned int tp_usec;
+ unsigned int ulong_size = 4;
+ unsigned char *raw_data;
+ struct utsname utsbuf;
h.raw = pcap_get_ring_frame(handle, TP_STATUS_USER);
if (!h.raw)
@@ -3385,11 +3388,19 @@
switch (handle->md.tp_version) {
case TPACKET_V1:
- tp_len = h.h1->tp_len;
- tp_mac = h.h1->tp_mac;
- tp_snaplen = h.h1->tp_snaplen;
- tp_sec = h.h1->tp_sec;
- tp_usec = h.h1->tp_usec;
+ raw_data = (unsigned char *)h.raw;
+ if (uname(&utsbuf) != -1) {
+ if(strstr(utsbuf.machine, "64") == NULL) {
+ ulong_size = 4;
+ } else {
+ ulong_size = 8;
+ }
+ }
+ tp_len = (__u32)raw_data[ulong_size];
+ tp_mac = (__u16)raw_data[ulong_size + 8];
+ tp_snaplen = (__u32)raw_data[ulong_size + 4];
+ tp_sec = (__u32)raw_data[ulong_size + 12];
+ tp_usec = (__u32)raw_data[ulong_size + 16];
break;
#ifdef HAVE_TPACKET2
case TPACKET_V2: