# foxio-llc/ja4 architecture

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

- Interactive diagram: https://gitdiagram.com/foxio-llc/ja4
- Repository: https://github.com/foxio-llc/ja4

## Overview

##### Project Type and Core Components

a) Core Fingerprinting Methods Layer
- JA4 (TLS Client)
- JA4S (TLS Server)
- JA4H (HTTP Client)
- JA4L/LS (Latency)
- JA4X (X509)
- JA4SSH (SSH)
- JA4T/TS (TCP)

b) Implementation Layer
- Python Implementation
- Rust Implementation
- Zeek Implementation
- Wireshark Plugin
- External Tool Integrations

**[Input Sources]**

- ▼
**[Packet Capture Layer]**

- ▼
**[Protocol Analysis Layer]**

- ▼
**[Fingerprint Generation Layer]**

- ▼
**[Output/Integration Layer]**

##### Component Details

a) Input Sources (Blue Rectangles)
- PCAP Files
- Live Traffic
- Network Streams

b) Processing Components (Green Hexagons)
- Packet Capture Handlers
- Protocol Analyzers
- Fingerprint Generators

c) Output Formats (Orange Rectangles)
- Human-readable Fingerprints
- Machine-readable Data
- Integration APIs

##### Implementation-specific Elements

a) Rust Implementation (Primary)
- Relationship between src/lib.rs and different modules
- Connection between pcap.rs, tls.rs, and http.rs

b) Python Implementation
- Interaction between ja4.py, ja4h.py, ja4ssh.py, and ja4x.py

c) Wireshark Plugin Architecture
- Integration points with Wireshark
- Packet processing flow

##### Data Flow Indicators

- Packet flow direction
- Data transformation steps
- Integration points with external tools
- Fingerprint generation process

##### Integration Points

Connections with:
- Wireshark
- Zeek
- Arkime
- Other supported tools (GreyNoise, Hunt, etc.)

##### Key Technical Elements

Specific technical components:
- Protocol handlers (TLS, HTTP, SSH, TCP)
- Fingerprint generation algorithms
- Data processing pipelines

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input ["Input Layer"]
        PCAP[("PCAP Files")]:::input
        LIVE[("Live Traffic")]:::input
        STREAM[("Network Streams")]:::input
    end

    subgraph Core ["Core Processing Layer"]
        direction TB
        subgraph Capture ["Packet Capture"]
            PCAPH["PCAP Handler"]:::processor
        end

        subgraph Analysis ["Protocol Analysis"]
            direction TB
            TLS["TLS Processing"]:::processor
            HTTP["HTTP Processing"]:::processor
            SSH["SSH Processing"]:::processor
            TCP["TCP Processing"]:::processor
            X509["X509 Processing"]:::processor
            LAT["Latency Analysis"]:::processor
        end

        subgraph FPGen ["Fingerprint Generation"]
            direction TB
            JA4["JA4 (TLS Client)"]:::fingerprint
            JA4S["JA4S (TLS Server)"]:::fingerprint
            JA4H["JA4H (HTTP Client)"]:::fingerprint
            JA4L["JA4L/LS (Latency)"]:::fingerprint
            JA4X["JA4X (X509)"]:::fingerprint
            JA4SSH["JA4SSH (SSH)"]:::fingerprint
            JA4T["JA4T/TS (TCP)"]:::fingerprint
        end
    end

    subgraph Impl ["Implementation Layer"]
        direction TB
        subgraph Python ["Python Implementation"]
            PY_JA4["JA4 Module"]:::python
            PY_JA4H["JA4H Module"]:::python
            PY_JA4SSH["JA4SSH Module"]:::python
            PY_JA4X["JA4X Module"]:::python
            PY_COMMON["Common Utilities"]:::python
        end

        subgraph Rust ["Rust Implementation"]
            RUST_TLS["TLS Module"]:::rust
            RUST_HTTP["HTTP Module"]:::rust
            RUST_SSH["SSH Module"]:::rust
            RUST_X509["X509 Module"]:::rust
            RUST_PCAP["PCAP Module"]:::rust
            RUST_TIME["Time Module"]:::rust
        end

        subgraph Zeek ["Zeek Implementation"]
            ZEEK_JA4["JA4 Script"]:::zeek
            ZEEK_JA4H["JA4H Script"]:::zeek
            ZEEK_JA4S["JA4S Script"]:::zeek
            ZEEK_JA4SSH["JA4SSH Script"]:::zeek
            ZEEK_JA4T["JA4T Script"]:::zeek
            ZEEK_JA4X["JA4X Script"]:::zeek
            ZEEK_JA4L["JA4L Script"]:::zeek
            ZEEK_COMMON["Common Utilities"]:::zeek
        end

        subgraph Wireshark ["Wireshark Plugin"]
            WS_CORE["Core Plugin"]:::wireshark
            WS_BUILD["Build System"]:::wireshark
        end
    end

    subgraph Output ["Output Layer"]
        DB[("JA4+ Mapping DB")]:::output
        DOCS["Technical Documentation"]:::output
        TEST["Test Data"]:::output
    end

    %% Connections
    PCAP & LIVE & STREAM --> PCAPH
    PCAPH --> Analysis
    Analysis --> FPGen
    FPGen --> DB
    
    %% Click events
    click PY_JA4 "https://github.com/FoxIO-LLC/ja4/blob/main/python/ja4.py"
    click PY_JA4H "https://github.com/FoxIO-LLC/ja4/blob/main/python/ja4h.py"
    click PY_JA4SSH "https://github.com/FoxIO-LLC/ja4/blob/main/python/ja4ssh.py"
    click PY_JA4X "https://github.com/FoxIO-LLC/ja4/blob/main/python/ja4x.py"
    click PY_COMMON "https://github.com/FoxIO-LLC/ja4/blob/main/python/common.py"
    
    click RUST_TLS "https://github.com/FoxIO-LLC/ja4/blob/main/rust/ja4/src/tls.rs"
    click RUST_HTTP "https://github.com/FoxIO-LLC/ja4/blob/main/rust/ja4/src/http.rs"
    click RUST_SSH "https://github.com/FoxIO-LLC/ja4/blob/main/rust/ja4/src/ssh.rs"
    click RUST_X509 "https://github.com/FoxIO-LLC/ja4/blob/main/rust/ja4x/src/lib.rs"
    click RUST_PCAP "https://github.com/FoxIO-LLC/ja4/blob/main/rust/ja4/src/pcap.rs"
    click RUST_TIME "https://github.com/FoxIO-LLC/ja4/tree/main/rust/ja4/src/time/"
    
    click ZEEK_JA4 "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4/main.zeek"
    click ZEEK_JA4H "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4h/main.zeek"
    click ZEEK_JA4S "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4s/main.zeek"
    click ZEEK_JA4SSH "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4ssh/main.zeek"
    click ZEEK_JA4T "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4t/main.zeek"
    click ZEEK_JA4X "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4x/__load__.zeek"
    click ZEEK_JA4L "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/ja4l/main.zeek"
    click ZEEK_COMMON "https://github.com/FoxIO-LLC/ja4/blob/main/zeek/utils/common.zeek"
    
    click WS_CORE "https://github.com/FoxIO-LLC/ja4/blob/main/wireshark/source/packet-ja4.c"
    click WS_BUILD "https://github.com/FoxIO-LLC/ja4/tree/main/wireshark/build-scripts/"
    click DB "https://github.com/FoxIO-LLC/ja4/blob/main/ja4plus-mapping.csv"
    click TEST "https://github.com/FoxIO-LLC/ja4/tree/main/pcap/"

    %% Styles
    classDef input fill:#a8d1f0
    classDef processor fill:#90EE90
    classDef fingerprint fill:#FFB6C1
    classDef output fill:#FFB347
    classDef python fill:#4B8BBE
    classDef rust fill:#DEA584
    classDef zeek fill:#8B8B8B
    classDef wireshark fill:#2B2B2B,color:white
```
