
Raw socket-based network packet sniffer that captures and disassembles TCP/IP packets from network interfaces for security analysis and educational use.
A network traffic monitor for GNU/Linux — formerly known as Packet-Sniffer. Frames are captured from one or more network interfaces with a raw socket, timestamped by the kernel itself, decoded layer by layer with the NETProtocols library, and rendered live, written to nanosecond-precision pcap, or streamed as JSON:
[>] Frame #4 at 15:42:07 (wlan0, 74 bytes)
[+] Ethernet 3c:7c:3f:1a:be:22 -> 9c:1e:95:aa:01:5f
EtherType: IPv4
[+] IPv4 192.168.1.96 -> 142.250.79.78
TTL: 64 | Flags: Don't fragment (DF) | Total Length: 60 | ID: 39754
Protocol: TCP | Checksum: 0x2b51
[+] TCP 51888 -> 443
Flags: 0x002 (SYN) | Seq: 3598801521 | Ack: 0
Window: 64240 | Checksum: 0x2008
Options: Maximum Segment Size (1460), SACK Permitted, Timestamps (3644437524, 0), No-Operation, Window Scale (7)
The decoder covers Ethernet (802.1Q VLAN tags, including nested QinQ
tagging), ARP, IPv4 (decoded options and fragments), IPv6
including extension headers (an MLD report renders its full
Hop-by-Hop chain) and Neighbor Discovery (a Router/Neighbor
Solicitation or Advertisement shows its target address and link-layer
options), ICMPv4/v6, TCP (options-aware payload offsets, decoded
options) and UDP. Every IPv4/ICMPv4/ICMPv6/TCP/UDP checksum is
verified against a recomputation, flagging a mismatch inline
(Checksum: 0x0000 [!] mismatch (expected 0x1a2b)) — a real signal
for corrupted or spoofed traffic, silent for a non-reassembled
fragment, where the wire checksum covers a datagram RootWire never
rebuilds. Malformed or truncated frames are diagnosed instead of
crashing the capture, unknown protocols end the chain gracefully, and
a 16-layer cap keeps crafted extension-header stacks from amplifying —
the capture survives whatever the network delivers.
pipx install rootwire # or: uv tool install rootwire
Or run from a clone with uv:
git clone https://github.com/EONRaider/RootWire.git
cd RootWire
uv sync
rootwire [-h] [-i INTERFACE] [-r FILE] [-w FILE]
[--filter NAME_OR_EXPR] [--json] [-d] [--version]
options:
-i, --interface interface to capture frames from; repeat to capture on
several interfaces concurrently (default: all interfaces)
-r, --read FILE replay frames from a pcap or pcapng file instead of live
capture (no privileges required; mutually exclusive
with -i)
-w, --write FILE also write every captured frame to a classic pcap file
--filter NAME_OR_EXPR
attach a kernel-side capture filter so only matching
frames reach userspace: a canned name (arp, ip6, tcp,
udp) or a filter expression -- protocols tcp/udp/icmp/
arp/ip/ip6; host/port, each optionally prefixed with
src/dst; and/or/not; parentheses (e.g. "tcp and port
80"); live capture only
--json one NDJSON object per frame on stdout (banner and
statistics stay on stderr): pipe straight into jq
-d, --data also display each frame's raw payload (ignored with --json)
Capture statistics — frames, bytes, frames/s, malformed/truncated
counts, per-protocol tallies — are reported on stderr when the capture
ends, whether that's Ctrl-C, SIGTERM, or (for -r) end of file: all
three trigger the same clean shutdown. Some favorite combinations:
sudo rootwire -i eth0 -w session.pcap # capture and keep the evidence
sudo rootwire -i eth0 --filter tcp # drop non-TCP in the kernel
sudo rootwire -i eth0 --filter "tcp and port 80" # kernel-side filter expression
sudo rootwire -i eth0 -i wlan0 # merge two interfaces into one stream
rootwire -r session.pcap # inspect it later, no root
rootwire -r session.pcap --json | jq . # machine-readable analysis
Live capture needs a raw socket, which on Linux means root
(sudo rootwire -i eth0) or granting the interpreter the
CAP_NET_RAW capability. Replaying files with -r never needs
privileges. From a clone, run it as sudo .venv/bin/python -m rootwire.
capture.py's capture_async() yields raw frames — merged from one
AF_PACKET socket per interface, each timestamped by the kernel
itself at arrival (SO_TIMESTAMPNS, not a userspace clock read) — as
(bytes, timestamp, interface) triples; replaying from a file with
-r adapts pcap.py's frames
into that same shape before either source reaches decoder.py, which
walks each frame's protocol chain into an immutable DecodedFrame.
Outputs — the screen renderer, the NDJSON stream, the pcap writer, the
statistics collector — consume every frame through one small Output
interface. The full tour, including why memory stays flat during long
captures and how to add an output, is in
ARCHITECTURE.md.
Everything except the raw socket runs on any OS, so the test suite — which includes a 65-frame corpus of real captured traffic replayed through the whole pipeline — needs neither root nor Linux:
uv run pytest
Bug reports and pull requests are welcome. CONTRIBUTING.md covers the development setup, the checks CI runs, and what a good pull request looks like here.
The use of code contained in this repository, either in part or in its totality, for engaging targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws.
Developers assume no liability and are not responsible for misuses or damages caused by any code contained in this repository in any event that, accidentally or otherwise, it comes to be utilized by a threat agent or unauthorized entity as a means to compromise the security, privacy, confidentiality, integrity, and/or availability of systems and their associated resources. In this context the term "compromise" is henceforth understood as the leverage of exploitation of known or unknown vulnerabilities present in said systems, including, but not limited to, the implementation of security controls, human- or electronically-enabled.
The use of this code is only endorsed by the developers in those circumstances directly related to educational environments or authorized penetration testing engagements whose declared purpose is that of finding and mitigating vulnerabilities in systems, limiting their exposure to compromises and exploits employed by malicious agents as defined in their respective threat models.