# hasherezade/hollows_hunter architecture

> Architecture diagram of the GitHub repository hasherezade/hollows_hunter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hasherezade/hollows_hunter
- Repository: https://github.com/hasherezade/hollows_hunter

## Overview

##### Project Type & Purpose
- Command-line security tool (C++), wraps a passive memory scanner (PE-sieve).
- Modes: one-off scan, continuous loop scan, ETW listener scan.
- Filters processes by PID, name, or creation time.

##### File Structure
Top-level artifacts:
– CMakeLists.txt, build scripts (.appveyor.yml, mingw_build.sh)
– Submodules: pe-sieve (core scanner lib), krabsetw (ETW API), paramkit (CLI parser), params_info (predefined argument sets)
Core modules:
– hh_params.{cpp,h}, hh_params_info → CLI parsing & config build
– main.cpp → scan controller, selects mode
– hh_scanner.{cpp,h} → wraps pe-sieve calls
– etw_listener.{cpp,h} & hh_settings.{cpp,h} → ETW subscription & settings
– hh_report.{cpp,h} → assemble & output scan results
– util/ → process privileges, suspension, string/time helpers

##### README
- Describes features, modes, and dependencies.
- Confirms use of PE-sieve library and Windows ETW subsystem.

##### Main Components & Interactions
a. CLI Layer
– Input: user arguments → paramkit + params_info → Settings object
b. Controller (main.cpp)
– Reads Settings → chooses scan mode
c. Scanner Module
– Invokes pe-sieve APIs → interrogates target process memory → returns Findings
d. ETW Listener
– Uses krabsetw to subscribe to kernel events → on event triggers Scanner
e. Report Generator
– Formats Findings → console output + optional dumps
f. Utilities
– Support modules (process_privilege, suspend, string/time utils)
g. External Services
– Windows OS kernel, ETW subsystem, file system for dumps

##### Architectural Patterns & Principles
- Separation of Concerns: parsing | control | scanning | reporting | utilities
- CMake orchestration: brings everything together into one executable

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Layer
    subgraph "CLI Layer"
        hh_params["hh_params"] 
        paramkit["paramkit"]
        params_info["params_info"]
    end

    %% Controller
    main["main.cpp"]

    %% Scanner Module
    subgraph "Scanner Module"
        hh_scanner["hh_scanner"]
        pe_sieve["pe-sieve"]
    end

    %% ETW Listener
    subgraph "ETW Listener"
        etw_listener["etw_listener"]
        etw_settings["etw_settings"]
        krabsetw["krabsetw"]
    end

    %% Report Generator
    hh_report["hh_report"]

    %% Utilities
    subgraph "Utilities"
        util_dir["util/"]
        term_util["term_util"]
    end

    %% External Systems
    OS["Windows OS / ETW subsystem"]

    %% Connections
    hh_params -->|Settings| main
    paramkit -->|Settings| main
    params_info -->|Settings| main

    main -->|Settings| hh_scanner
    main -->|Settings| etw_listener

    etw_listener -->|ETW Event| hh_scanner

    hh_scanner -->|Findings| hh_report

    hh_scanner -->|Process Memory| OS
    etw_listener -->|Subscribe ETW| OS
    hh_report -->|Write Dumps| OS

    util_dir -.-> hh_params
    util_dir -.-> main
    util_dir -.-> hh_scanner
    util_dir -.-> etw_listener
    util_dir -.-> etw_settings
    util_dir -.-> hh_report
    util_dir -.-> term_util

    %% Click Events
    click hh_params "https://github.com/hasherezade/hollows_hunter/blob/master/hh_params.cpp"
    click paramkit "https://github.com/hasherezade/hollows_hunter/tree/master/paramkit/"
    click params_info "https://github.com/hasherezade/hollows_hunter/tree/master/params_info/"
    click main "https://github.com/hasherezade/hollows_hunter/blob/master/main.cpp"
    click hh_scanner "https://github.com/hasherezade/hollows_hunter/blob/master/hh_scanner.cpp"
    click pe_sieve "https://github.com/hasherezade/hollows_hunter/tree/master/pe-sieve/"
    click etw_listener "https://github.com/hasherezade/hollows_hunter/blob/master/etw_listener.cpp"
    click etw_settings "https://github.com/hasherezade/hollows_hunter/blob/master/etw_settings.cpp"
    click krabsetw "https://github.com/hasherezade/hollows_hunter/tree/master/krabsetw/"
    click hh_report "https://github.com/hasherezade/hollows_hunter/blob/master/hh_report.cpp"
    click util_dir "https://github.com/hasherezade/hollows_hunter/tree/master/util/"
    click term_util "https://github.com/hasherezade/hollows_hunter/blob/master/term_util.cpp"
    click CMakeLists "https://github.com/hasherezade/hollows_hunter/blob/master/CMakeLists.txt"
    click AppVeyor "https://github.com/hasherezade/hollows_hunter/blob/master/.appveyor.yml"
    click Mingw "https://github.com/hasherezade/hollows_hunter/blob/master/mingw_build.sh"
    click GHWorkflow "https://github.com/hasherezade/hollows_hunter/blob/master/.github/workflows/main.yml"

    %% Styles
    classDef internal fill:#D0E6FF,stroke:#0366d6,color:#000
    classDef thirdparty fill:#D4F8E8,stroke:#28a745,color:#000
    classDef util fill:#E0E0E0,stroke:#6a737d,color:#000
    classDef external fill:#FFE5B4,stroke:#d97706,color:#000

    class hh_params,main,hh_scanner,etw_listener,etw_settings,hh_report internal
    class paramkit,params_info,pe_sieve,krabsetw thirdparty
    class util_dir,term_util util
    class OS external
```
