Skip to main content

RootWire

CodeFactor CI PyPI Python Version OS License

A network traffic monitor for GNU/Linux — formerly known as Packet-Sniffer. Frames are captured from a network interface with a raw socket, decoded layer by layer with the NETProtocols library, and rendered live, written to 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: 20 bytes

The decoder covers Ethernet, ARP, IPv4 (options and fragments), IPv6 including extension headers (an MLD report renders its full Hop-by-Hop chain), ICMPv4/v6, TCP (options-aware payload offsets) and UDP. 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.

Installation

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

Usage

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 classic pcap file instead of live
                    capture (no privileges required)
  -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 (tcp, udp, arp,
                    ip6) 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. 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.

How it works

capture.py's capture_async() yields raw frames — merged from one AF_PACKET socket per interface — 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

Roadmap

  • Checksum verification rendering (the library already computes them)

Contributing

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.

License

AGPL-3.0

Metadata

Release files for rootwire 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rootwire 6.0.0
File Size Uploaded
rootwire-6.0.0.tar.gz 117.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rootwire 6.0.0
File Interpreter ABI Platform
rootwire-6.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 161.9 kB

Release files / rootwire-6.0.0.tar.gz

Download URL rootwire-6.0.0.tar.gz
Size 117.1 kB
Tags Source
SHA-256 checksum
How to use checksums
460d2dc81bca00ad828e2c79dc925272a9836e5eb83e182365c0730089a4983a
BLAKE2b-256 checksum
How to use checksums
60570a198a86d83f7498a13d4a0d0cc74d588a59e2a8d4d1b55e5fc3503cebcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / rootwire-6.0.0-py3-none-any.whl

Download URL rootwire-6.0.0-py3-none-any.whl
Size 44.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
707722b14d43e6d66bb985656c79c180bb04c4b801cf3ad38de5a25e43eb48a0
BLAKE2b-256 checksum
How to use checksums
70573438fef0727c1dd1e8263992c3b42e8b0d5c09d4bf86764cb067c0eb95f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files

5.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page