Skip to main content

ReconGraph

Reconstruction of Forensic Timelines Using Graph Theory

recongraph is a Python library and CLI that reconstructs and visualizes system behavior from logs of various devices (e.g. Windows and Linux). It converts Plaso log2timeline CSV files into a forensic graph timeline: by parsing sequential log data and matching it against Sigma rules, recongraph builds a MultiDiGraph (Multi-Directed Graph) representing the state transitions and operational flow of the target system. This aids forensic analysis, anomaly detection, and understanding complex system behavior across platforms.

This tool is based on the paper: Forensic Event Reconstruction for Drones.

Table of Contents

Features

  • Sigma Rule-Based Pattern Matching: Leverages standardized Sigma rules to identify and label security-relevant events in raw logs.
  • Forensic Graph Construction: Transforms sequential log entries from Plaso (log2timeline) into a directed graph, where nodes represent detected events and edges represent temporal transitions.
  • Intelligent Log Detection: Automatically identifies various log formats (e.g., Apache, Linux auth, Syslog) and extracts relevant metadata like HTTP methods, URIs, and status codes.
  • Weighted Behavioral Mapping: Edges are weighted by transition frequency, helping to distinguish common flows from rare or suspicious sequences.
  • Anomaly-Focused Reconstruction: Specifically isolates and maps behaviors based on rule severity levels (Critical, High, Medium, Low).
  • Multi-Format Export: Exports graphs to GraphML for visualization (Gephi, Cytoscape, or the bundled web visualizer) and detailed forensic timelines to CSV.

Prerequisites

  • Python 3.13 or higher
  • Git
  • pip (and, recommended, a virtual environment via venv or conda)
  • Sigma rules — see Sigma Rules Setup

Prefer a zero-setup, dependency-free environment? Skip straight to Install via Docker — no local Python required.

Installation

There are three ways to install recongraph: from PyPI, from source, or via Docker. For the PyPI and source methods, set up a virtual environment first.

Set Up a Virtual Environment

Using venv (recommended):

python -m venv venv

# Activate it:
source venv/bin/activate        # Linux / macOS
venv\Scripts\activate           # Windows (PowerShell / CMD)

Or using Anaconda / Miniconda:

conda create -n recongraph python=3.13
conda activate recongraph

Install from PyPI

pip install recongraph

Install from Source

  1. Clone the repository

    git clone https://github.com/forensic-timeline/recongraph
    
  2. Install the package (editable mode)

    cd recongraph
    pip install -e .
    

Install via Docker

This is the recommended approach for a fully isolated, dependency-free environment — no Python installation required on your machine.

Prerequisite: Docker must be installed and running.

The image uses a multi-stage build to keep the final image small:

  1. A builder stage installs build tools and compiles the Python dependencies.
  2. A runtime stage copies only the compiled libraries and source code, and automatically downloads the Sigma Core rules into /app/sigma.

Step 1 — Build the image (run once, from the project root):

docker build -t recongraph .

Step 2 — Prepare a data directory for your input logs and output files:

mkdir data

Place your Plaso CSV file (e.g., forensic_timeline.csv) inside data/.

You are now ready to run the container — see Run with Docker.

Sigma Rules Setup

recongraph uses Sigma rules to label and detect events. You must provide a rules directory — without one, no events are matched and the resulting graph is empty. The rules directory is resolved in this order:

  1. the -r/--rules command-line option, if given; otherwise
  2. the SIGMA_RULES_PATH environment variable, if set.

Download the official rules from SigmaHQ/sigma:

git clone https://github.com/SigmaHQ/sigma

You can then point -r at the cloned sigma/rules directory (or any folder of .yml rules).

Docker note: the Docker image already bundles the Sigma Core rules at /app/sigma and sets SIGMA_RULES_PATH=/app/sigma, so they are used automatically — no -r needed. Pass -r only to override with your own rules.

Sigma rules are released under the Detection Rule License (DRL) 1.1.

Quick Start

Run Locally

recongraph -f /path/to/plaso-file.csv \
           -r /path/to/sigma/rules \
           -o reconstruction_edge_graph.graphml

Add --export-csv and --export-sigma to also produce the detailed event-log CSV and the Sigma-labeled CSV:

recongraph -f forensic_timeline.csv \
           -r ./sigma/rules \
           -o result.graphml \
           --export-csv \
           --export-sigma

Run with Docker

Mount your local data/ folder into the container and pass your arguments. The bundled Sigma Core rules are used automatically (via SIGMA_RULES_PATH), so no -r is required:

# Linux / macOS
docker run --rm -v "$(pwd)/data:/app/data" recongraph \
  -f forensic_timeline.csv \
  -o result.graphml \
  --export-csv \
  --export-sigma

# Windows (PowerShell)
docker run --rm -v "${PWD}\data:/app/data" recongraph `
  -f forensic_timeline.csv `
  -o result.graphml

To use your own rules instead, mount them as an extra volume and point -r at the mount:

docker run --rm \
  -v "$(pwd)/data:/app/data" \
  -v "$(pwd)/my_sigma_rules:/app/custom_sigma" \
  recongraph -f forensic_timeline.csv -r /app/custom_sigma

Alternatively, use Docker Compose (mounts ./data automatically):

docker compose run --rm recongraph -f forensic_timeline.csv -o result.graphml

--rm removes the container after it finishes. All output files are written back to your local data/ folder.

Command-Line Options

Option Description Default
-f, --file Path to the input file (CSV or TXT). Required. —
-r, --rules Path to the Sigma rules directory. $SIGMA_RULES_PATH if set, else none
-o, --output Output filename for the GraphML file. reconstruction_edge_graph.graphml
--export-csv Also export detailed event logs to a CSV file. reconstruction_event_logs.csv
--export-sigma Also export the Sigma-labeled DataFrame to a CSV file. <input>_sigma_labeled.csv
--strict Disable flexible matching (enable strict logsource validation). flexible mode

Input Data Format

Log File (<filename>.csv)

A sequential log file of system activities. recongraph supports the CSV format produced by Plaso (log2timeline).

Sigma Rules (rules directory)

A directory of standardized Sigma rules in .yml format that define the detection logic used to label events. See Sigma Rules Setup.

Output

The tool generates the following files:

  • GraphML File (reconstruction_edge_graph.graphml): A directed graph where nodes are detected events and edges represent the flow between them. Suitable for the bundled visualizer, Gephi, or Cytoscape.
  • Event Logs CSV (reconstruction_event_logs.csv, with --export-csv): A detailed breakdown of every log entry associated with a graph node, including timestamps and raw message content.
  • Sigma Labeled CSV (<filename>_sigma_labeled.csv, with --export-sigma): The input log file augmented with matching Sigma rule titles and severity levels.

Visualizing the Graph

The repository ships with a standalone, single-file web visualizer at recongraph/visualizer.html. It requires no build step or server:

  1. Open recongraph/visualizer.html in a web browser.
  2. Click Load GraphML (or drag the file onto the page) and select your reconstruction_edge_graph.graphml.

The visualizer provides force-directed, circular, hierarchical, and radial layouts, severity filtering, node search, a node inspector, and SVG/JSON export.

How to Test

The test suite lives in the tests/ directory.

  1. Install the test dependencies:

    pip install pytest pandas pyyaml
    
  2. Run the tests from the project root:

    pytest -v
    

    You should see output indicating that all tests pass.

Documentation

Full documentation is available at ReadTheDocs.

Licenses

ReconGraph

This project is licensed under the MIT License.

Third-Party Licenses

This project uses Sigma Rules for event detection:

Metadata

Release files for recongraph 0.0.4

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

Source distribution (sdist)

Source distribution for recongraph 0.0.4
File Size Uploaded Provenance Actions
recongraph-0.0.4.tar.gz 20.7 kB With provenance Details for recongraph-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 36.4 kB

Release files / recongraph-0.0.4.tar.gz

Download URL recongraph-0.0.4.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2fb43d4a2a030b491500090d1a43f9f751deac679f5cba1b95aba19685e4c40b
BLAKE2b-256 checksum
How to use checksums
f896ed5ddcef56a390354f3d5cd1678a79c47586bfbf965a3b6a8e1e8feadefa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / recongraph-0.0.4-py3-none-any.whl

Download URL recongraph-0.0.4-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9117af9131561a62a0b606e88bec5724ed5ba53f17fd9f854158bc936ac19e5
BLAKE2b-256 checksum
How to use checksums
6e60eb789d863f9d8aea787efa96161ded3494b0d24b9b9c17eb23b8f161ca74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Security for recongraph 0.0.4

Provenance

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for recongraph-0.0.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

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.

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