# krystaldevv/steganalysis-detector architecture

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

- Interactive diagram: https://gitdiagram.com/krystaldevv/steganalysis-detector
- Repository: https://github.com/krystaldevv/steganalysis-detector

## Overview

This is a command-line image steganalysis tool with a companion LSB message embedder and extractor. The main analysis workflow loads an image, computes LSB and histogram heuristics, classifies the results, generates three plots, and prints a verdict. The alternate workflow embeds a message and saves a stego-image; the embedder also supports standalone extraction. The README documents these capabilities, while the edges below rely on the shown entry-point and analysis code; image files and saved plots are represented as file artifacts.

Main entry points: [`src/embedder.py`](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/embedder.py) (Embed And Extract), [`src/detector.py`](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py) (Analysis Orchestrator), [`main.py`](https://github.com/krystaldevv/steganalysis-detector/blob/main/main.py) (Main CLI), [`src/utils.py`](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py) (Image Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command Line"]
  node_entry["Main CLI<br/>[main.py]"]
  node_image_loader["Image Loader<br/>[utils.py]"]
end

subgraph group_analysis["Steganalysis"]
  node_analyzer["Analysis Orchestrator<br/>[detector.py]"]
  node_lsb_tests["LSB Heuristics<br/>[lsb_analysis.py]"]
  node_histogram_tests["Histogram Heuristics"]
  node_classifier["Rule Classifier<br/>[detector.py]"]
end

subgraph group_reporting["Results"]
  node_plotter["Plot Generator<br/>[detector.py]"]
  node_plot_saver["Plot Saver<br/>[utils.py]"]
  node_plots["Analysis Plots"]
  node_result_printer["Result Printer<br/>[utils.py]"]
end

subgraph group_stego["Message Steganography"]
  node_embedder["Embed And Extract<br/>[embedder.py]"]
  node_stego_image["Stego Image"]
end

node_user(("User"))
node_input_image["Input Image"]
node_message["Secret Message"]
node_terminal["Terminal Output"]

node_user -->|"runs"| node_entry
node_entry -->|"loads image"| node_image_loader
node_input_image -->|"read by"| node_image_loader
node_entry -->|"calls analyze"| node_analyzer
node_image_loader -->|"supplies image"| node_analyzer
node_analyzer -->|"runs tests"| node_lsb_tests
node_analyzer -->|"runs tests"| node_histogram_tests
node_analyzer -->|"classifies results"| node_classifier
node_lsb_tests -->|"returns metrics"| node_classifier
node_histogram_tests -->|"returns metrics"| node_classifier
node_analyzer -->|"generates plots"| node_plotter
node_plotter -->|"saves figures"| node_plot_saver
node_plot_saver -->|"writes files"| node_plots
node_entry -->|"prints verdict"| node_result_printer
node_result_printer -->|"writes report"| node_terminal
node_user -->|"requests embed or extract"| node_embedder
node_entry -->|"calls embed_lsb"| node_embedder
node_image_loader -->|"supplies image"| node_embedder
node_message -->|"embedded by"| node_embedder
node_embedder -->|"writes image"| node_stego_image
node_stego_image -->|"read for extraction"| node_embedder
node_embedder -->|"prints extracted text"| node_terminal

click node_entry "https://github.com/krystaldevv/steganalysis-detector/blob/main/main.py"
click node_image_loader "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py"
click node_input_image "https://github.com/krystaldevv/steganalysis-detector/tree/main/images"
click node_analyzer "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py"
click node_lsb_tests "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/lsb_analysis.py"
click node_histogram_tests "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/histogram_analysis.py"
click node_classifier "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py"
click node_plotter "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py"
click node_plot_saver "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py"
click node_plots "https://github.com/krystaldevv/steganalysis-detector/tree/main/output"
click node_result_printer "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py"
click node_embedder "https://github.com/krystaldevv/steganalysis-detector/blob/main/src/embedder.py"
click node_stego_image "https://github.com/krystaldevv/steganalysis-detector/tree/main/images/stego"

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_entry,node_image_loader,node_user toneBlue
class node_analyzer,node_lsb_tests,node_histogram_tests,node_classifier toneAmber
class node_plotter,node_plot_saver,node_plots,node_result_printer toneMint
class node_embedder,node_stego_image toneRose
class node_input_image toneTeal
class node_message,node_terminal toneIndigo
```

## Components

### Command Line

- [Main CLI](https://github.com/krystaldevv/steganalysis-detector/blob/main/main.py): `main.py`
- [Image Loader](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py): `src/utils.py`

### Steganalysis

- [Analysis Orchestrator](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py): `src/detector.py`
- [LSB Heuristics](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/lsb_analysis.py): `src/lsb_analysis.py`
- [Histogram Heuristics](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/histogram_analysis.py): `src/histogram_analysis.py`
- [Rule Classifier](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py): `src/detector.py`

### Results

- [Plot Generator](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/detector.py): `src/detector.py`
- [Plot Saver](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py): `src/utils.py`
- [Analysis Plots](https://github.com/krystaldevv/steganalysis-detector/tree/main/output): `output`
- [Result Printer](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/utils.py): `src/utils.py`

### Message Steganography

- [Embed And Extract](https://github.com/krystaldevv/steganalysis-detector/blob/main/src/embedder.py): `src/embedder.py`
- [Stego Image](https://github.com/krystaldevv/steganalysis-detector/tree/main/images/stego): `images/stego`

### Other components

- **User**
- [Input Image](https://github.com/krystaldevv/steganalysis-detector/tree/main/images): `images`
- **Secret Message**
- **Terminal Output**

## Connections

- User → Main CLI: runs (evidence: `README.md`)
- Main CLI → Image Loader: loads image (evidence: `main.py`)
- Input Image → Image Loader: read by (evidence: `src/utils.py`)
- Main CLI → Analysis Orchestrator: calls analyze (evidence: `main.py`)
- Image Loader → Analysis Orchestrator: supplies image (evidence: `main.py`)
- Analysis Orchestrator → LSB Heuristics: runs tests (evidence: `src/detector.py`)
- Analysis Orchestrator → Histogram Heuristics: runs tests (evidence: `src/detector.py`)
- Analysis Orchestrator → Rule Classifier: classifies results (evidence: `src/detector.py`)
- LSB Heuristics → Rule Classifier: returns metrics (evidence: `src/detector.py`)
- Histogram Heuristics → Rule Classifier: returns metrics (evidence: `src/detector.py`)
- Analysis Orchestrator → Plot Generator: generates plots (evidence: `src/detector.py`)
- Plot Generator → Plot Saver: saves figures (evidence: `src/detector.py`)
- Plot Saver → Analysis Plots: writes files (evidence: `src/utils.py`)
- Main CLI → Result Printer: prints verdict (evidence: `main.py`)
- Result Printer → Terminal Output: writes report (evidence: `src/utils.py`)
- User → Embed And Extract: requests embed or extract (evidence: `README.md`)
- Main CLI → Embed And Extract: calls embed_lsb (evidence: `main.py`)
- Image Loader → Embed And Extract: supplies image (evidence: `main.py`)
- Secret Message → Embed And Extract: embedded by (evidence: `src/embedder.py`)
- Embed And Extract → Stego Image: writes image
- Stego Image → Embed And Extract: read for extraction (evidence: `src/embedder.py`)
- Embed And Extract → Terminal Output: prints extracted text (evidence: `src/embedder.py`)
