Skip to content

Instantly share code, notes, and snippets.

View 2opremio's full-sized avatar

Alfonso Acosta 2opremio

View GitHub Profile
@2opremio
2opremio / bpf.c
Last active October 17, 2023 04:15 — forked from msantos/bpf.c
Example of using bpf to capture packets in OSX
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <err.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
@2opremio
2opremio / rawfilter.c
Last active April 28, 2022 21:44 — forked from oro350/rawfilter.c
BPF test: filter tcp segments to port 80
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netpacket/packet.h>