GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - andrewbrooks/tracewatch: Experiment: a Linux flight recorder for a launched process (Tracee eBPF + mitmproxy) with an interactive HTML report

BranchesTags
Open more actions menu

Latest commit

 

History

94 Commits
94 Commits

Folders and files

NameName
Last commit message
Last commit date
.githooks
.githooks
 
 
.github
.github
 
 
docs
docs
 
 
spikes
spikes
 
 
src/tracewatch
src/tracewatch
 
 
tests
tests
 
 
tools
tools
 
 
.gitignore
.gitignore
 
 
.gitleaks.toml
.gitleaks.toml
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

Repository files navigation

tracewatch

An experiment: run a command under a Linux process tracer and an intercepting HTTPS proxy, then turn what happened into a report you can read, click around in, or diff against another run.

It started as a way to play with Tracee (eBPF process tracing) and mitmproxy, and to see how far a coding assistant could take that. It is a toy-sized "flight recorder", not a security product: nothing here has been hardened, audited, or tested beyond the scenarios in this repository.

Live demo

Interactive example reports (real output from example runs, with paths, names and IP addresses replaced): https://andrewbrooks.github.io/tracewatch/. The simulated-intruder report is the best place to start.

Screenshots

From the scripted demo workload (tests/fixtures/demo.sh). Machine-specific paths, user and host names and IP addresses were replaced before rendering (tests/browser/screenshots.py).

Overview, dark theme

Process tree A simulated intruder: the chain of notable steps

What it does

tracewatch record -- <command> [args...]     # run it; recording ends when the command exits
tracewatch report <run-dir>                  # interactive HTML report (default), or --format md | json
tracewatch diff <run-a> <run-b>              # what behaved differently? (--format md | json | html)
tracewatch verify <run-dir>                  # what can be trusted in this recording?
tracewatch sweep [--dry-run]                 # clean up after a recorder that died (--dry-run: only preview)

Add -v before the command name (tracewatch -v record ...) to see debug diagnostics on stderr; warnings and errors are always shown.

For the command you launch (and everything it starts) it records:

  • the process tree: who started whom, with full command lines and exit codes
  • network activity: HTTP(S) requests and responses through the proxy (including HTTP/2 and websockets), which process sent each one, DNS lookups the proxy performed, and TCP connections that bypassed the proxy
  • file activity for a short watch list (credential stores, temp directories), not every file open, and the contents of the files the process created or wrote there (inert, size-capped, secrets redacted; files it only read are never captured)
  • 24 rule-based findings (e.g. "wrote a file, then executed it", "credential sent over plain HTTP"), each pointing at the events that triggered it. Every rule has an entry in a built-in dictionary (what it means, what it cannot tell you, what benign activity looks the same, and whether it has ever fired on a real recording), shown in the report. The severities are rough heuristics, not measurements

The interactive report is a single self-contained HTML file (no network access, dark and light themes, keyboard navigation, prints reasonably). The Markdown report is the same information as a flat file.

Requirements

  • Linux. It was developed and tested on WSL2 (Docker Desktop and Docker Engine, kernel 6.18); plain Linux with Docker should work but has not been exercised.
  • Python 3.12+ (tested on 3.12 and 3.14) and uv
  • Docker that can run a container with extra Linux capabilities, including SYS_ADMIN (Tracee runs as aquasec/tracee:0.24.1, the only version it has been tested with)
  • setpriv (util-linux) and curl (used by the demo and tests)

Tracee runs as a container with host PID access and elevated capabilities, including SYS_ADMIN. See SECURITY.md. Only run this on a machine where that is acceptable.

Quick start

git clone https://github.com/andrewbrooks/tracewatch.git && cd tracewatch
uv sync
.venv/bin/tracewatch record --out out/runs --name hello -- sh -c 'curl -s https://example.com/ >/dev/null'
.venv/bin/tracewatch report out/runs/hello          # writes out/runs/hello/report.html
.venv/bin/tracewatch report out/runs/hello --format md -o -

Starting takes several seconds (two Tracee starts) and stopping takes a couple more. tests/fixtures/demo.sh records a scripted workload against local servers (secrets, a dropped binary, a proxy bypass, websockets) if you want something with findings in it.

How it works, briefly

  1. The recorder starts mitmdump with a fresh per-run CA and launches the target held at a wrapper, so Tracee can be attached before the real command runs.
  2. Tracee (in Docker) is scoped to the target's process tree and writes events; the proxy writes one record per connection and request. Secrets are redacted before anything is written.
  3. When the root process exits, the recorder drains and stops everything.
  4. Afterwards, report joins the two streams: each proxy connection is matched to a process by who held the socket and by Tracee's connect events on a shared clock. The result is one JSON model that three renderers turn into HTML, Markdown, or JSON.

The proxy is only used by clients that honor HTTP(S)_PROXY and the CA environment variables (curl, Python requests, Node, git, ...). Everything else is still traced by the kernel side, and connections that skip the proxy are flagged, but their content is not recorded.

Things worth knowing

  • Runs are sensitive. A run directory and its reports contain the (redacted) traffic and command lines of whatever you ran. Redaction is pattern-based and not guaranteed to catch everything. Treat runs as private.
  • Not a sandbox. It observes; it does not contain or restrict the target.
  • Attribution has limits. A request is attributed to the process that sent it when that can be shown. If a process inherits another's socket, sends, and exits before the proxy looks, it can be misattributed or shown as unknown (the report says which).
  • Not covered: QUIC/HTTP/3 and other UDP payloads (visible as connections only), clients that pin certificates (reported as "refused the certificate", content not recorded), very long runs, and Windows or macOS.
  • Recording is bounded. Size caps stop storing bodies, then events, and the report says when a cap was hit.

Development

make setup                          # uv sync --locked, and enables the pre-commit hook
make check                          # ruff, mypy and the unit tests (no Docker needed)
make help                           # every task, including format, secrets, audit-deps and build

The pre-commit hook scans staged changes for secrets (gitleaks) and checks lint and formatting. The redaction tests hold fake credentials on purpose; .gitleaks.toml allows them by file path, so a secret-shaped string anywhere else is flagged. CI runs the same checks plus type checking, a dependency audit and the browser suite.

Commit messages: a summary of 72 characters or fewer in the imperative, a blank line, then a body that says why. The commit-msg hook (enabled by make setup) checks this.

Integration tests (tests/integration/*.sh) record real processes and need Docker and the Tracee image. CI does not run them; run them before a release and after changing the container flags in src/tracewatch/tracee.py. The browser tests (tests/browser/run.py; run uv run playwright install chromium first, TW_BROWSER=firefox for Firefox) check the interactive report's behavior, accessibility basics, and the security properties of the embedded data. tests/browser/axe_check.py runs an optional axe-core accessibility audit. tools/audit.py checks a repository for things that should not be published, and tools/build_examples.py rebuilds the example reports in docs/. tools/privilege_probe.py measures how much privilege the Tracee container needs (it prints a plan unless you pass --run).

Documentation

  • How it works: recording, reconstruction, rendering, testing
  • Limitations: what it cannot see or get right
  • Findings reference: what every rule means, what it cannot tell you, and its evidence
  • Security notes: the container's elevated privileges, what recordings contain, the simulated intruder

Status

An experiment. The interfaces and the data format may change without notice. Licensed under the Apache License, Version 2.0.

About

Experiment: a Linux flight recorder for a launched process (Tracee eBPF + mitmproxy) with an interactive HTML report

andrewbrooks.github.io/tracewatch/

Topics

dfirebpflinuxmitmproxyobservabilityprocess-tracingpythonruntime-securitytracee

Resources

Readme
Apache-2.0 license

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.