Skip to main content Switch to mobile version nettattle 0.1.0 Monitor outbound network connections per process and record data-transfer volumes
pip install nettattle Copy PIP instructions
Catch the small, fast, easy-to-miss thing on your network.
A lightweight CLI that watches outbound TCP connections, maps each to its owning process, and records how many bytes each process sends and receives over time. It is meant to surface quiet background exfiltration: processes that send small, steady amounts of data.
Supported: macOS (nettop) and Linux (ss, iproute2 with kernel 4.x+). Requires Python 3.10+; the only dependency is psutil.
pipx install nettattle # or: uv tool install nettattle pip install nettattle # into an existing environment From a checkout, uv build produces the wheel and sdist in dist/, and pip install dist/nettattle-*.whl installs it. The package provides a nettattle command (also python -m nettattle).
nettattle --monitor # sample every 5s into ./nettattle.db nettattle --monitor --interval 10 nettattle --report # top talkers by bytes sent nettattle --report --since 1h --limit 10 nettattle --report --by-destination # per process + remote endpoint nettattle --report --resolve # ...plus reverse-DNS host names nettattle --report --suspicious # beacon-like and upload-heavy flows nettattle --report --processes # traffic per executable + code signature nettattle --monitor --retain 30d # also delete data older than 30 days Options: --db PATH (default nettattle.db), --include-loopback, -v/--verbose.
Process identity (--processes)
A process name is chosen by whoever starts the process, so malware can call itself updaterd. For every process with traffic, the monitor also records the executable path, user, parent process and start time, and on macOS the code signature (Apple, Developer ID + team, App Store, ad-hoc, unsigned, or invalid). The start time keeps two processes that reused the same PID apart.
--report --processes lists traffic per name + executable + signature, with flagged identities first:
Signatures are checked with /usr/bin/codesign --verify --strict --all-architectures (by absolute path), once per binary. codesign -dv alone is not enough: a tampered binary still displays its original Apple authority. Ad-hoc signatures are shown but not flagged, because locally built tools (Homebrew, uv's Python) are ad-hoc signed. Command lines are not recorded, as they often contain secrets. Use --no-identity to turn identity recording off.
The Identity column in --suspicious and in the dashboard shows the same information. Traffic recorded before this feature existed, or from processes that exited before they could be inspected, shows ?.
By default nothing is deleted. --monitor --retain 30d deletes traffic (and process records) older than 30 days at startup and then every hour, in small batches so reports and the dashboard are not blocked. SQLite reuses the freed space; the file itself does not shrink unless you run VACUUM.
Suspicious flows (--suspicious)
Each flow (process + remote IP + port) is checked for two behaviours, using the data already recorded:
beacon: regular timing and similar burst sizes, as malware check-ins tend to have. The score (0-100) combines how many gaps between active samples match the median gap with how many bursts are within 25% of the median size. Flows scoring 70 or more with at least 6 events are flagged. Periods shorter than three sampling intervals must match exactly, because looser matching cannot tell them apart from random traffic.
upload-heavy: sent at least 16 KiB and at least 3x what was received. Exfiltration sends more than it receives; normal browsing is the reverse.
Legitimate push and keepalive channels (OS notification services, chat apps) are beacons too and will be flagged. The flag describes behaviour, not intent. Combine with --since and --resolve as needed. The dashboard shows the same flows in a "Suspicious flows" panel.
--resolve looks up a reverse-DNS (PTR) name for each remote IP in the report and shows it in a Host column (it implies --by-destination). Things to know:
Names are forward-confirmed. Whoever controls an IP sets its PTR record, so a malicious server can claim to be updates.apple.com. A name is shown plainly only if it resolves back to the same IP; otherwise it is marked (unverified).
Many IPs have no useful name. Cloud and CDN addresses usually have no PTR record or a generic one (ec2-…amazonaws.com); that is not the hostname the application connected to.
Lookups happen only at report time, never while monitoring, all at once within --resolve-timeout seconds (default 5). Lookups that don't finish show ? (timeout).
Results are cached in .dns-cache.json (or --dns-cache PATH): 24 h for names, 1 h for "no name". Timeouts are not cached.
nettattle --serve # http://127.0.0.1:8765/ nettattle --serve --port 9000 --db nettattle.db A read-only dashboard over the same database: totals, traffic over time for the top processes, a talkers table with an Active column (share of sampled intervals with traffic), and a destinations table with optional FCrDNS host names. It auto-refreshes every 10 seconds and needs no extra dependencies.
It binds to 127.0.0.1 by default. --host 0.0.0.0 exposes it to your network with no authentication; the tool prints a warning when you do this.
Requests whose Host header is not localhost, an IP address or the --host value are rejected (protection against DNS rebinding). Only GET is allowed.
Process and host names come from the monitored system and are treated as untrusted: the page never renders them as HTML, and a strict Content-Security-Policy blocks inline scripts.
--report and --serve can run while --monitor is writing (SQLite WAL mode).
In the report, Intervals counts the sampling intervals in which a process moved data. A process with a small byte total but a high interval count is talking steadily in the background.
Without root the tool still runs, but it sees less: on Linux, other users' sockets are recorded as (pid -1). For full visibility, run the monitor as root. Tools installed with pipx or uv tool are usually not on root's PATH, so pass the full path:
sudo "$(command -v nettattle)" --monitor --db /var/db/nettattle.db The database is created relative to the current directory unless you pass --db; one first created under sudo is owned by root.
uv sync # .venv with the project installed uv run nettattle-dev.py --monitor # same CLI as nettattle uv run python -m unittest discover tests/ uv build # wheel + sdist into dist/ From a checkout, run as root with sudo .venv/bin/python nettattle-dev.py --monitor. Do not use sudo uv run: it can leave root-owned files in .venv.
The OS reports cumulative counters per socket. Each cycle, NetTattle subtracts the previous sample for the same socket (identified by local port and remote endpoint) and stores only non-zero per-interval deltas. The first sample after startup is a baseline and is not recorded. A counter that goes backwards is treated as a fresh socket.
Parser tests run against real captured nettop and ss output in tests/fixtures/, so they pass on any OS.
Net + tattle: it tells you what your machine has been saying on the network behind your back. NetTattle is an independent project, inspired by Little Snitch but not affiliated with or endorsed by Objective Development, its makers.
Apache-2.0 View SPDX License List
beacon exfiltration monitoring nettop network security ss
Development Status 3 - Alpha
Intended Audience Information Technology
Programming Language Python :: 3
System :: Networking :: Monitoring
Release files for nettattle 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 123.0 kB
Release files / nettattle-0.1.0.tar.gz
Release files / nettattle-0.1.0-py3-none-any.whl
Security for nettattle 0.1.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Oct 31, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




