# itskaran01/malware-scanner architecture

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

- Interactive diagram: https://gitdiagram.com/itskaran01/malware-scanner
- Repository: https://github.com/itskaran01/malware-scanner

## Overview

A small command-line malware scanner: a user selects a directory, the scanner checks files against hash, header, and heuristic indicators, quarantines detected threats, and prints and logs a report. The single Python module implements these stages. The listed JSON file’s name differs from the signature filename the code opens, so the graph shows that signature database as an external file rather than linking the listed file. Signature updating is not implemented in the executable path.

Main entry points: [`malwarescanning.py`](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py) (Directory scan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command line"]
  node_cli["CLI entry<br/>[malwarescanning.py]"]
end

subgraph group_scanning["Scanning and response"]
  node_scanner["Scanner setup<br/>[malwarescanning.py]"]
  node_signatures[("Signature database")]
  node_directory["Directory scan<br/>[malwarescanning.py]"]
  node_hash["Hash check<br/>[malwarescanning.py]"]
  node_heuristics["Heuristic check<br/>[malwarescanning.py]"]
  node_quarantine["Quarantine<br/>[malwarescanning.py]"]
end

subgraph group_reporting["Reporting"]
  node_report["Report generation<br/>[malwarescanning.py]"]
  node_log["Log file"]
end

node_user(("User"))
node_quarantine_dir[("Quarantine directory")]

node_user -->|"runs"| node_cli
node_cli -->|"creates"| node_scanner
node_scanner -->|"loads"| node_signatures
node_cli -->|"starts scan"| node_directory
node_directory -->|"checks hash"| node_hash
node_directory -->|"checks heuristics"| node_heuristics
node_directory -->|"checks header and hashes"| node_signatures
node_directory -->|"quarantines threats"| node_quarantine
node_quarantine -->|"moves file"| node_quarantine_dir
node_cli -->|"generates report"| node_report
node_directory -->|"logs errors"| node_log
node_quarantine -->|"logs failures"| node_log
node_report -->|"appends report"| node_log

click node_cli "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_scanner "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_directory "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_hash "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_heuristics "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_quarantine "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"
click node_report "https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py"

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_cli,node_user toneBlue
class node_scanner,node_signatures,node_directory,node_hash,node_heuristics,node_quarantine,node_quarantine_dir toneAmber
class node_report,node_log toneMint
```

## Components

### Command line

- [CLI entry](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`

### Scanning and response

- [Scanner setup](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`
- **Signature database**
- [Directory scan](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`
- [Hash check](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`
- [Heuristic check](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`
- [Quarantine](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`

### Reporting

- [Report generation](https://github.com/itskaran01/malware-scanner/blob/main/malwarescanning.py): `malwarescanning.py`
- **Log file**

### Other components

- **User**
- **Quarantine directory**

## Connections

- User → CLI entry: runs (evidence: `malwarescanning.py`)
- CLI entry → Scanner setup: creates (evidence: `malwarescanning.py`)
- Scanner setup → Signature database: loads (evidence: `malwarescanning.py`)
- CLI entry → Directory scan: starts scan (evidence: `malwarescanning.py`)
- Directory scan → Hash check: checks hash (evidence: `malwarescanning.py`)
- Directory scan → Heuristic check: checks heuristics (evidence: `malwarescanning.py`)
- Directory scan → Signature database: checks header and hashes (evidence: `malwarescanning.py`)
- Directory scan → Quarantine: quarantines threats (evidence: `malwarescanning.py`)
- Quarantine → Quarantine directory: moves file (evidence: `malwarescanning.py`)
- CLI entry → Report generation: generates report (evidence: `malwarescanning.py`)
- Directory scan → Log file: logs errors (evidence: `malwarescanning.py`)
- Quarantine → Log file: logs failures (evidence: `malwarescanning.py`)
- Report generation → Log file: appends report (evidence: `malwarescanning.py`)
