# withsecureopensource/chainsaw architecture

> Architecture diagram of the GitHub repository withsecureopensource/chainsaw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/withsecureopensource/chainsaw
- Repository: https://github.com/withsecureopensource/chainsaw

## Overview

Chainsaw is a command-line Windows forensic triage tool. Investigators provide artefacts and detection rules, then search or hunt for matches and emit reports; separate analysis commands inspect event-log gaps, Shimcache timelines, and SRUM usage. The graph preserves those documented capabilities and the sampled reader, rule, search, and output layers. Some command implementations and integrations were not fully excerpted, so uncertain connections are omitted rather than inferred.

Main entry points: [`src/cli.rs`](https://github.com/withsecureopensource/chainsaw/blob/master/src/cli.rs) (CLI commands), [`src/file/mod.rs`](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/mod.rs) (Artefact reader), [`src/file/hve/mod.rs`](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/mod.rs) (Registry hive parser), [`src/rule/mod.rs`](https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/mod.rs) (Rule loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["User workflow"]
  node_commands["CLI commands<br/>[cli.rs]"]
  node_output["Result output<br/>[write.rs]"]
end

subgraph group_ingest["Artefact ingestion"]
  node_reader["Artefact reader<br/>[mod.rs]"]
  node_evtx["EVTX parser<br/>[evtx.rs]"]
  node_registry["Registry hive parser<br/>[mod.rs]"]
  node_amcache["Amcache parser<br/>[amcache.rs]"]
  node_shimcache["Shimcache parser<br/>[shimcache.rs]"]
  node_srum_parser["SRUM parsers<br/>[srum.rs]"]
  node_esedb["ESE database parser<br/>[mod.rs]"]
  node_mft["MFT parser<br/>[mft.rs]"]
end

subgraph group_detect["Search and detection"]
  node_search["String and regex search<br/>[search.rs]"]
  node_hunt["Rule hunting<br/>[hunt.rs]"]
  node_rule_loader["Rule loading<br/>[mod.rs]"]
  node_sigma["Sigma conversion<br/>[sigma.rs]"]
  node_custom_rules["Chainsaw rules<br/>[chainsaw.rs]"]
  node_tau["TAU matching support<br/>[tau.rs]"]
  node_values["Document values<br/>[value.rs]"]
end

subgraph group_analysis["Forensic analysis"]
  node_evtx_analysis["EVTX analysis<br/>[evtx.rs]"]
  node_gap_analysis["Event-log gaps<br/>[gaps.rs]"]
  node_shim_analysis["Shimcache timeline<br/>[shimcache.rs]"]
  node_srum_analysis["SRUM analysis<br/>[srum.rs]"]
  node_reports["Reports<br/>[cli.rs]"]
end

node_investigator(("Investigator"))
node_artefacts["Windows artefacts"]
node_rule_files["Detection rule files"]
node_sigma_files["Sigma mappings"]
node_srum_store[("SRUM ESE database")]

node_investigator -->|"runs commands"| node_commands
node_artefacts -->|"provides files"| node_reader
node_commands -->|"loads artefacts"| node_reader
node_reader -->|"dispatches EVTX"| node_evtx
node_reader -->|"dispatches hives"| node_registry
node_reader -->|"dispatches MFT"| node_mft
node_registry -->|"provides hive data"| node_amcache
node_registry -->|"provides hive data"| node_shimcache
node_registry -->|"provides hive data"| node_srum_parser
node_commands -->|"starts search"| node_search
node_commands -->|"starts hunt"| node_hunt
node_commands -->|"starts analysis"| node_evtx_analysis
node_commands -->|"starts analysis"| node_gap_analysis
node_commands -->|"starts analysis"| node_shim_analysis
node_commands -->|"starts analysis"| node_srum_analysis
node_hunt -->|"loads rules"| node_rule_loader
node_rule_loader -->|"converts Sigma"| node_sigma
node_rule_loader -->|"loads custom rules"| node_custom_rules
node_rule_loader -->|"uses matching support"| node_tau
node_hunt -->|"reads documents"| node_reader
node_search -->|"reads documents"| node_reader
node_hunt -->|"matches documents"| node_values
node_search -.->|"matches documents"| node_values
node_rule_files -->|"supplies rules"| node_rule_loader
node_sigma_files -->|"supplies mappings"| node_sigma
node_evtx_analysis -->|"analyses logs"| node_evtx
node_gap_analysis -->|"checks log gaps"| node_evtx
node_shim_analysis -->|"reads hive data"| node_registry
node_shim_analysis -.->|"enriches timeline"| node_amcache
node_srum_analysis -->|"analyses SRUM"| node_srum_parser
node_srum_analysis -->|"reads tables"| node_esedb
node_srum_store -->|"contains records"| node_esedb
node_commands -->|"formats results"| node_output
node_output -->|"emits reports"| node_reports

click node_commands "https://github.com/withsecureopensource/chainsaw/blob/master/src/cli.rs"
click node_output "https://github.com/withsecureopensource/chainsaw/blob/master/src/write.rs"
click node_reader "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/mod.rs"
click node_evtx "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/evtx.rs"
click node_registry "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/mod.rs"
click node_amcache "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/amcache.rs"
click node_shimcache "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/shimcache.rs"
click node_srum_parser "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/srum.rs"
click node_esedb "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/esedb/mod.rs"
click node_mft "https://github.com/withsecureopensource/chainsaw/blob/master/src/file/mft.rs"
click node_search "https://github.com/withsecureopensource/chainsaw/blob/master/src/search.rs"
click node_hunt "https://github.com/withsecureopensource/chainsaw/blob/master/src/hunt.rs"
click node_rule_loader "https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/mod.rs"
click node_sigma "https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/sigma.rs"
click node_custom_rules "https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/chainsaw.rs"
click node_tau "https://github.com/withsecureopensource/chainsaw/blob/master/src/ext/tau.rs"
click node_rule_files "https://github.com/withsecureopensource/chainsaw/tree/master/rules"
click node_sigma_files "https://github.com/withsecureopensource/chainsaw/tree/master/mappings"
click node_values "https://github.com/withsecureopensource/chainsaw/blob/master/src/value.rs"
click node_evtx_analysis "https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/evtx.rs"
click node_gap_analysis "https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/gaps.rs"
click node_shim_analysis "https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/shimcache.rs"
click node_srum_analysis "https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/srum.rs"
click node_reports "https://github.com/withsecureopensource/chainsaw/blob/master/src/cli.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_commands,node_output toneBlue
class node_reader,node_evtx,node_registry,node_amcache,node_shimcache,node_srum_parser,node_esedb,node_mft,node_srum_store toneAmber
class node_search,node_hunt,node_rule_loader,node_sigma,node_custom_rules,node_tau,node_values toneMint
class node_evtx_analysis,node_gap_analysis,node_shim_analysis,node_srum_analysis,node_reports toneRose
class node_investigator,node_artefacts toneIndigo
class node_rule_files,node_sigma_files toneTeal
```

## Components

### User workflow

- [CLI commands](https://github.com/withsecureopensource/chainsaw/blob/master/src/cli.rs): `src/cli.rs`
- [Result output](https://github.com/withsecureopensource/chainsaw/blob/master/src/write.rs): `src/write.rs`

### Artefact ingestion

- [Artefact reader](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/mod.rs): `src/file/mod.rs`
- [EVTX parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/evtx.rs): `src/file/evtx.rs`
- [Registry hive parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/mod.rs): `src/file/hve/mod.rs`
- [Amcache parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/amcache.rs): `src/file/hve/amcache.rs`
- [Shimcache parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/shimcache.rs): `src/file/hve/shimcache.rs`
- [SRUM parsers](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/hve/srum.rs): `src/file/hve/srum.rs`
- [ESE database parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/esedb/mod.rs): `src/file/esedb/mod.rs`
- [MFT parser](https://github.com/withsecureopensource/chainsaw/blob/master/src/file/mft.rs): `src/file/mft.rs`

### Search and detection

- [String and regex search](https://github.com/withsecureopensource/chainsaw/blob/master/src/search.rs): `src/search.rs`
- [Rule hunting](https://github.com/withsecureopensource/chainsaw/blob/master/src/hunt.rs): `src/hunt.rs`
- [Rule loading](https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/mod.rs): `src/rule/mod.rs`
- [Sigma conversion](https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/sigma.rs): `src/rule/sigma.rs`
- [Chainsaw rules](https://github.com/withsecureopensource/chainsaw/blob/master/src/rule/chainsaw.rs): `src/rule/chainsaw.rs`
- [TAU matching support](https://github.com/withsecureopensource/chainsaw/blob/master/src/ext/tau.rs): `src/ext/tau.rs`
- [Document values](https://github.com/withsecureopensource/chainsaw/blob/master/src/value.rs): `src/value.rs`

### Forensic analysis

- [EVTX analysis](https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/evtx.rs): `src/analyse/evtx.rs`
- [Event-log gaps](https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/gaps.rs): `src/analyse/gaps.rs`
- [Shimcache timeline](https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/shimcache.rs): `src/analyse/shimcache.rs`
- [SRUM analysis](https://github.com/withsecureopensource/chainsaw/blob/master/src/analyse/srum.rs): `src/analyse/srum.rs`
- [Reports](https://github.com/withsecureopensource/chainsaw/blob/master/src/cli.rs): `src/cli.rs`

### Other components

- **Investigator**
- **Windows artefacts**
- [Detection rule files](https://github.com/withsecureopensource/chainsaw/tree/master/rules): `rules`
- [Sigma mappings](https://github.com/withsecureopensource/chainsaw/tree/master/mappings): `mappings`
- **SRUM ESE database**

## Connections

- Investigator → CLI commands: runs commands (evidence: `README.md`)
- Windows artefacts → Artefact reader: provides files (evidence: `src/file/mod.rs`)
- CLI commands → Artefact reader: loads artefacts (evidence: `src/cli.rs`)
- Artefact reader → EVTX parser: dispatches EVTX (evidence: `src/file/mod.rs`)
- Artefact reader → Registry hive parser: dispatches hives (evidence: `src/file/mod.rs`)
- Artefact reader → MFT parser: dispatches MFT (evidence: `src/file/mod.rs`)
- Registry hive parser → Amcache parser: provides hive data (evidence: `src/file/hve/mod.rs`)
- Registry hive parser → Shimcache parser: provides hive data (evidence: `src/file/hve/mod.rs`)
- Registry hive parser → SRUM parsers: provides hive data (evidence: `src/file/hve/mod.rs`)
- CLI commands → String and regex search: starts search (evidence: `src/cli.rs`)
- CLI commands → Rule hunting: starts hunt (evidence: `src/cli.rs`)
- CLI commands → EVTX analysis: starts analysis (evidence: `src/cli.rs`)
- CLI commands → Event-log gaps: starts analysis (evidence: `src/cli.rs`)
- CLI commands → Shimcache timeline: starts analysis (evidence: `src/cli.rs`)
- CLI commands → SRUM analysis: starts analysis (evidence: `src/cli.rs`)
- Rule hunting → Rule loading: loads rules (evidence: `src/hunt.rs`)
- Rule loading → Sigma conversion: converts Sigma (evidence: `src/rule/mod.rs`)
- Rule loading → Chainsaw rules: loads custom rules (evidence: `src/rule/mod.rs`)
- Rule loading → TAU matching support: uses matching support (evidence: `src/rule/mod.rs`)
- Rule hunting → Artefact reader: reads documents (evidence: `src/hunt.rs`)
- String and regex search → Artefact reader: reads documents (evidence: `src/search.rs`)
- Rule hunting → Document values: matches documents (evidence: `src/hunt.rs`)
- String and regex search → Document values: matches documents
- Detection rule files → Rule loading: supplies rules (evidence: `README.md`)
- Sigma mappings → Sigma conversion: supplies mappings (evidence: `README.md`)
- EVTX analysis → EVTX parser: analyses logs (evidence: `src/analyse/evtx.rs`)
- Event-log gaps → EVTX parser: checks log gaps (evidence: `src/analyse/gaps.rs`)
- Shimcache timeline → Registry hive parser: reads hive data (evidence: `src/analyse/shimcache.rs`)
- Shimcache timeline → Amcache parser: enriches timeline
- SRUM analysis → SRUM parsers: analyses SRUM (evidence: `src/analyse/srum.rs`)
- SRUM analysis → ESE database parser: reads tables (evidence: `src/analyse/srum.rs`)
- SRUM ESE database → ESE database parser: contains records (evidence: `README.md`)
- CLI commands → Result output: formats results (evidence: `src/cli.rs`)
- Result output → Reports: emits reports (evidence: `README.md`)
