# gh0stkey/hae architecture

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

- Interactive diagram: https://gitdiagram.com/gh0stkey/hae
- Repository: https://github.com/gh0stkey/hae

## Overview

##### Project Type and Purpose
- HaE is a cybersecurity framework that focuses on processing HTTP traffic to help ethical hackers and analysts quickly sort and extract high-value message data.
- The README emphasizes its role in vulnerability discovery by reducing noise and highlighting significant HTTP/WebSocket messages.
- It is designed to integrate with tools like BurpSuite (using the Montoya API), and it is structured as a modular Java project.

##### Analyzing the File Structure
- The top-level “src/main/java/hae” directory is organized into sub-packages:
- Core classes: “HaE.java” and “Config.java” (in the root and component directories) serve as the application’s main entry points and configuration handlers.
- “component” package: Includes modules like “board”, “rule”, and utility components. For example, the board submodules (Databoard, MessageRenderer, etc.) manage the data display panels, while rule packages manage parsing and applying rules.
- “instances” package: Contains specialized handlers for different protocols:
o “http”: With editors and handlers (for both active and passive HTTP message processing).
o “websocket”: For managing WebSocket-specific messages.
- “utils” packages: Provide shared functionality (configuration loading, data management, string processing, and HTTP utilities).
- “cache” package: Implements caching (e.g., MessageCache) to temporarily store and manage HTTP message data.
- Also, external resources such as the rules file (Rules.yml) and logos are stored under “src/main/resources” for dynamic configuration and UI elements.

a. Main Components:
- Core Application Module:
- Entry Point (HaE.java) and Main Configuration (Config.java) which initialize the system and load settings.
- Component-Based Modules:
- Board Components: Databoard, Datatable, and message display classes that manage UI display – responsible for showing annotated and extracted HTTP messages.
- Rule Engine Components: Classes under “component/rule” and utilities under “utils/rule” that parse, process, and apply extraction rules using regular expressions.
- Protocol-Specific Instances:
- HTTP Modules: Including editors (RequestEditor, ResponseEditor), message handlers (ActiveHandler, PassiveHandler), and processing utilities that work on HTTP requests/responses.
- WebSocket Module: Manages WebSocket-specific data flow through the WebSocketMessageHandler.
- Utility and Support Modules:
- Caching (under “cache” module), configuration loading (ConfigLoader), data management (DataManager), UI enhancements, and string processing mechanisms.
- External Integration:
- Integration hooks providing seamless data storage with BurpSuite’s project data management.

b. Relationships and Data Flow:
- HTTP/WS traffic flows from external sources into the “Instances” layer, where messages are captured.
- Captured messages then pass to the Rule Engine, where multi-engine regex matching (using DFA and NFA engines) is applied.
- Processed data is forwarded to Board Components, which then display and annotate messages. Concurrently, the Message Cache holds interim results.
- Utility modules support all layers by providing configuration, logging, and data management.
- Integration with BurpSuite is highlighted by showing how project data is stored/updated on message processing.

c. Architectural Patterns and Design Principles:
- Modular “Lego brick” approach – each component is loosely coupled and interchangeable.
- Use of common design patterns, for example:
- MVC-like separation within the board components (data model vs. visual rendering).
- A clear separation between protocol handling (HTTP and WebSocket) and business logic (rule processing).
- How the multi-engine regex support (DFA/NFA) is abstracted within rule processing components.

d. Relevant Technologies and Frameworks:
- Java as the primary language with Gradle as the build tool (indicated by build.gradle and settings.gradle).
- Integration and dependency on the Montoya API and BurpSuite as part of its deployment environment.
- Use of YAML configuration (Rules.yml) to allow dynamic rule loading.
- Standard Java libraries and custom utilities for HTTP processing and UI enhancements.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Traffic
    External["HTTP/WS Traffic"]:::external

    %% Core Application Layer
    subgraph "Core Application"
        HaE["Core (HaE.java)"]:::core
        Config["Config (Config.java)"]:::core
    end

    %% Protocol-Specific Instances Layer
    subgraph "Protocol-Specific Instances"
        subgraph "HTTP Modules"
            ReqEditor["RequestEditor"]:::protocol
            RespEditor["ResponseEditor"]:::protocol
            HttpActive["HttpMessageActiveHandler"]:::protocol
            HttpPassive["HttpMessagePassiveHandler"]:::protocol
            HttpProc["MessageProcessor"]:::protocol
            RegMatcher["RegularMatcher"]:::protocol
        end
        subgraph "WebSocket Module"
            WsEditor["WebSocketEditor"]:::protocol
            WsHandler["WebSocketMessageHandler"]:::protocol
        end
    end

    %% Rule Engine Layer
    subgraph "Rule Engine"
        Display["Display"]:::rule
        Rule["Rule"]:::rule
        Rules["Rules"]:::rule
        RuleProc["RuleProcessor"]:::rule
        Group["Group (Rule Model)"]:::rule
        Info["Info (Rule Model)"]:::rule
    end

    %% Board UI Components Layer
    subgraph "Board UI Components"
        Databoard["Databoard"]:::ui
        MessageRenderer["MessageRenderer"]:::ui
        MessageEntry["MessageEntry"]:::ui
        MessageTableModel["MessageTableModel"]:::ui
        Datatable["Datatable"]:::ui
    end

    %% Utility & Support Modules Layer
    subgraph "Utility & Support Modules"
        Cache["MessageCache"]:::utils
        ConfigLoader["ConfigLoader"]:::utils
        DataManager["DataManager"]:::utils
        UIEnhancer["UIEnhancer"]:::utils
        HttpUtils["HttpUtils"]:::utils
        StringProcessor["StringProcessor"]:::utils
        HashCalculator["HashCalculator"]:::utils
    end

    %% External Resources Layer
    subgraph "External Resources"
        RulesYml["Rules.yml"]:::external
        Logo["Logo"]:::external
    end

    %% Integration Node
    Burp["BurpSuite Integration"]:::integration

    %% Relationships
    %% Core initialization
    HaE --> ReqEditor
    HaE --> RespEditor
    HaE --> HttpActive
    HaE --> HttpPassive
    HaE --> WsEditor
    HaE --> WsHandler
    Config --> ConfigLoader

    %% External Traffic flows into protocol handlers
    External -->|"capture"| ReqEditor
    External -->|"capture"| WsEditor

    %% Protocol modules feeding into Rule Engine
    ReqEditor -->|"process"| RuleProc
    RespEditor -->|"process"| RuleProc
    HttpActive -->|"process"| RuleProc
    HttpPassive -->|"process"| RuleProc
    HttpProc -->|"process"| RuleProc
    RegMatcher -->|"match"| RuleProc
    WsHandler -->|"process"| RuleProc

    %% Rule Engine internal processing
    RuleProc -->|"apply"| Display
    RuleProc -->|"apply"| Rule
    RuleProc -->|"apply"| Rules
    RuleProc -->|"model"| Group
    RuleProc -->|"model"| Info

    %% Rule Engine forwarding processed data to Board UI
    RuleProc -->|"render"| Databoard
    RuleProc -->|"render"| MessageRenderer
    RuleProc -->|"render"| MessageEntry
    RuleProc -->|"render"| MessageTableModel
    RuleProc -->|"render"| Datatable

    %% Caching support from Rule Engine
    RuleProc -->|"cache"| Cache

    %% Utility Modules supporting processing and UI
    ConfigLoader -->|"configures"| RuleProc
    DataManager -->|"supports"| RuleProc
    UIEnhancer -->|"enhances"| Datatable
    StringProcessor -->|"formats"| RuleProc
    HashCalculator -->|"validates"| RuleProc
    HttpUtils -->|"assists"| ReqEditor

    %% Board UI Integration with external tool
    Databoard -->|"updates"| Burp
    MessageRenderer -->|"updates"| Burp
    MessageEntry -->|"updates"| Burp
    MessageTableModel -->|"updates"| Burp
    Datatable -->|"updates"| Burp

    %% Click Events for Core Application
    click HaE "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/HaE.java"
    click Config "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/Config.java"

    %% Click Events for Board Components
    click Databoard "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/board/Databoard.java"
    click MessageRenderer "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/board/message/MessageRenderer.java"
    click MessageEntry "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/board/message/MessageEntry.java"
    click MessageTableModel "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/board/message/MessageTableModel.java"
    click Datatable "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/board/table/Datatable.java"

    %% Click Events for Rule Engine Components
    click Display "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/rule/Display.java"
    click Rule "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/rule/Rule.java"
    click Rules "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/component/rule/Rules.java"
    click RuleProc "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/rule/RuleProcessor.java"
    click Group "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/rule/model/Group.java"
    click Info "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/rule/model/Info.java"

    %% Click Events for Protocol-Specific HTTP Modules
    click ReqEditor "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/editor/RequestEditor.java"
    click RespEditor "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/editor/ResponseEditor.java"
    click HttpActive "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/http/HttpMessageActiveHandler.java"
    click HttpPassive "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/http/HttpMessagePassiveHandler.java"
    click HttpProc "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/http/utils/MessageProcessor.java"
    click RegMatcher "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/http/utils/RegularMatcher.java"

    %% Click Events for WebSocket Module
    click WsEditor "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/editor/WebSocketEditor.java"
    click WsHandler "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/instances/websocket/WebSocketMessageHandler.java"

    %% Click Events for Utility & Support Modules
    click Cache "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/cache/MessageCache.java"
    click ConfigLoader "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/ConfigLoader.java"
    click DataManager "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/DataManager.java"
    click UIEnhancer "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/UIEnhancer.java"
    click HttpUtils "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/http/HttpUtils.java"
    click StringProcessor "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/string/StringProcessor.java"
    click HashCalculator "https://github.com/gh0stkey/hae/blob/master/src/main/java/hae/utils/string/HashCalculator.java"

    %% Click Events for External Resources
    click RulesYml "https://github.com/gh0stkey/hae/blob/master/src/main/resources/rules/Rules.yml"
    click Logo "https://github.com/gh0stkey/hae/tree/master/src/main/resources/logo"

    %% Styles
    classDef core fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef protocol fill:#ccffcc,stroke:#006600,stroke-width:2px;
    classDef rule fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef ui fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef utils fill:#e0e0e0,stroke:#999999,stroke-width:2px;
    classDef external fill:#ffe6cc,stroke:#ff9900,stroke-width:2px;
    classDef integration fill:#d9ead3,stroke:#38761d,stroke-width:2px;
```
