All Projects → c-bata → xpcap

c-bata / xpcap

Licence: other
Cross-platform Packet Capture which supports Linux and macOS(BSD) in 1000 LOC without depending on libpcap.

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects
CMake
9771 projects

Projects that are alternatives of or similar to xpcap

NetStalker
A network tool to control the bandwidth over your local network.
Stars: ✭ 69 (+263.16%)
Mutual labels:  packet-sniffer, packet-capture
arp-dns-attacks
ARP spoofing, HTTP redirection, DNS spoofing and DNS forging using pcap library
Stars: ✭ 25 (+31.58%)
Mutual labels:  packet-sniffer, packet-capture
Xdp
Package xdp allows one to use XDP sockets from the Go programming language.
Stars: ✭ 36 (+89.47%)
Mutual labels:  network-programming, packet-capture
Divert.Net
.NET Wrapper for WinDivert
Stars: ✭ 51 (+168.42%)
Mutual labels:  packet-sniffer, packet-capture
Jxnet
Jxnet is a Java library for capturing and sending custom network packet buffers with no copies. Jxnet wraps a native packet capture library (libpcap/winpcap/npcap) via JNI (Java Native Interface).
Stars: ✭ 26 (+36.84%)
Mutual labels:  packet-sniffer, packet-capture
Scapy
Scapy: the Python-based interactive packet manipulation program & library. Supports Python 2 & Python 3.
Stars: ✭ 6,932 (+36384.21%)
Mutual labels:  packet-sniffer, packet-capture
Divert
WinDivert: Windows Packet Divert
Stars: ✭ 1,318 (+6836.84%)
Mutual labels:  network-programming, packet-capture
WinDivertSharp
A minimal .NET binding over WinDivert
Stars: ✭ 91 (+378.95%)
Mutual labels:  packet-sniffer, packet-capture
rvi capture
rvictl for Linux and Windows: capture packets sent/received by iOS devices
Stars: ✭ 124 (+552.63%)
Mutual labels:  packet-sniffer, packet-capture
DivertPInvoke
PInvoke wrapper for WinDivert
Stars: ✭ 22 (+15.79%)
Mutual labels:  packet-sniffer, packet-capture
check zpools
Monitor the usage and status of ZFS Pools (zpools)
Stars: ✭ 16 (-15.79%)
Mutual labels:  bsd
vigor
Main repository of the Vigor NF verification project.
Stars: ✭ 40 (+110.53%)
Mutual labels:  network-programming
BCA-Phantom
A multi-platform HTTP(S) Reverse Shell Server and Client in Python 3
Stars: ✭ 80 (+321.05%)
Mutual labels:  network-programming
ccalendar
Chinese Calendar in calendar(1) for BSD, Linux & macOS
Stars: ✭ 17 (-10.53%)
Mutual labels:  bsd
cxx
🔌 Configuration-free utility for building, testing and packaging executables written in C++. Can auto-detect compilation flags based on includes, via the package system and pkg-config.
Stars: ✭ 87 (+357.89%)
Mutual labels:  bsd
netbots
NetBots is a python programming game inspired by the 1970s game RobotWar.
Stars: ✭ 16 (-15.79%)
Mutual labels:  network-programming
julia
A lightweight high performance http server
Stars: ✭ 111 (+484.21%)
Mutual labels:  network-programming
awesome-systools
Awesome Systools is a collection of sysadmins daily handy tools.
Stars: ✭ 81 (+326.32%)
Mutual labels:  bsd
FreeBSD-Ask
FreeBSD 教程——FreeBSD 从入门到跑路。
Stars: ✭ 113 (+494.74%)
Mutual labels:  bsd
go-networking
Code sample for Learning Network Programming with Go
Stars: ✭ 134 (+605.26%)
Mutual labels:  network-programming

XPCAP: cross(X)-platform Packet CAPture

Cross-platform packet capture, supports Linux, macOS(BSD) without depending on libpcap. Supported Protocols are ARP, IPv4, IPv6, TCP, UDP and ICMP.

xpcap

See article: How to write cross-platform packet capture using RAW Socket and BPF.

How to run

At first, please check your network interface devices using ifconfig:

$ ifconfig
lo0: ...
 :
en0: ...
 :

After that compiled xpcap via build.sh or cmake and run it:

$ ./build.sh
$ ./xpcap en0 -v
device = en0, verbose = 1, port = 0

================================================================================
[TCP6]
ether_header--------------------------------------------------------------------
ether_dhost = XX:XX:XX:XX:XX:XX
ether_shost = XX:XX:XX:XX:XX:XX
ether_type = 86DD(IPv6)
ip6-----------------------------------------------------------------------------
ip6_vfc = 96
ip6_flow = 2363892320
ip6_plen = 15104
(TCP), ip6_hlim = 56
ip6_src = xxxx:xxxx:xxxx:x::xxxx:xxxx
ip6_dst = yyyy:yy:yyyy:yyyy:yyyy:yyyy:yyyy:yyyy
tcphdr--------------------------------------------------------------------------
source: 47873
destination: 59083
sequence number: 1148644729
ack number = 2897299570
data offset = 5, control flag = 24, window = 49152, checksum = 54057, urgent pointer = 0
data----------------------------------------------------------------------------
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ..something..data..
================================================================================

================================================================================
[ARP]
ether_header--------------------------------------------------------------------
ether_dhost = XX:XX:XX:XX:XX:XX
ether_shost = XX:XX:XX:XX:XX:XX
ether_type = 806(Address resolution)
ether_arp-----------------------------------------------------------------------
arp_hrd = 1(Ethernet 10/100Mbps.), arp_pro = 2048(IP)
arp_hln = 6, arp_pln = 4, arp_op = 1(ARP request.)
arp_sha = 34:76:C5:77:5D:4C
arp_spa = 192.168.0.1
arp_tha = 00:00:00:00:00:00
arp_tpa = 192.168.0.8
================================================================================

================================================================================
[UDP]
ether_header--------------------------------------------------------------------
ether_dhost = XX:XX:XX:XX:XX:XX
ether_shost = XX:XX:XX:XX:XX:XX
ether_type = 800(IP)
ip------------------------------------------------------------------------------
ip_v = 4, ip_hl = 5, ip_tos = 0, ip_len = 149
ip_id = 29282, ip_off = 0, 0
ip_ttl = 255, ip_p = 17(UDP), ip_sum = 42831
ip_src = yyy.yyy.yyy.yyy
ip_dst = xxx.xxx.xxx.xxx
udphdr--------------------------------------------------------------------------
source = 5353, dest = 5353
len = 129, check = 38825
data----------------------------------------------------------------------------
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ..something..data..
================================================================================

If you are macOS user and want to test xpcap on Linux, please creating VM image from the Vagrantfile.

LICENSE

MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].