# maliceio/malice architecture

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

- Interactive diagram: https://gitdiagram.com/maliceio/malice
- Repository: https://github.com/maliceio/malice

## Overview

Malice is a Docker-based malware analysis framework intended to provide a self-hosted VirusTotal-style workflow. The main path accepts a sample through the CLI, records file metadata, stores the sample for container access, and dispatches enabled intelligence and MIME-selected plugins; results are stored in Elasticsearch. Separate CLI capabilities manage plugins, look up hashes, watch folders, and start the ELK-backed UI. The graph also shows Docker operations and the API surface. Some command implementations and API routes were not sampled, so those branches are documented or left without speculative internal links.

Main entry points: [`commands/scan.go`](https://github.com/maliceio/malice/blob/master/commands/scan.go) (Scan workflow), [`malice/docker/client/container/run.go`](https://github.com/maliceio/malice/blob/master/malice/docker/client/container/run.go) (Container operations), [`malice/docker/client/client.go`](https://github.com/maliceio/malice/blob/master/malice/docker/client/client.go) (Docker client), [`main.go`](https://github.com/maliceio/malice/blob/master/main.go) (Malice CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and API"]
  node_cli["Malice CLI<br/>[main.go]"]
  node_scan["Scan workflow<br/>[scan.go]"]
  node_other_commands["Other commands"]
  node_api["HTTP API"]
end

subgraph group_analysis["Sample analysis"]
  node_file_info["File metadata<br/>[file.go]"]
  node_sample_store[("Sample volume<br/>[filestore.go]")]
  node_plugin_dispatch["Plugin dispatch<br/>[plugins.go]"]
  node_plugin_management["Plugin management<br/>[plugin.go]"]
end

subgraph group_runtime["Docker runtime"]
  node_docker_client["Docker client<br/>[client.go]"]
  node_container_ops["Container operations<br/>[run.go]"]
  node_image_ops["Image operations<br/>[image.go]"]
  node_database_start["Elasticsearch startup<br/>[database.go]"]
  node_plugin_containers["Analysis plugins<br/>[plugins.go]"]
end

subgraph group_results["Results and UI"]
  node_elasticsearch[("Elasticsearch")]
  node_ui_start["Kibana startup<br/>[ui.go]"]
  node_kibana["Kibana UI"]
end

node_user(("Researcher"))

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches scan"| node_scan
node_cli -->|"dispatches commands"| node_other_commands
node_scan -->|"creates client"| node_docker_client
node_scan -->|"cleans containers"| node_container_ops
node_scan -->|"starts database"| node_database_start
node_scan -->|"reads sample"| node_file_info
node_scan -->|"copies sample"| node_sample_store
node_scan -->|"stores file info"| node_elasticsearch
node_scan -->|"runs plugins"| node_plugin_dispatch
node_plugin_dispatch -->|"starts plugins"| node_plugin_containers
node_plugin_containers -->|"starts containers"| node_container_ops
node_plugin_management -->|"manages plugins"| node_plugin_dispatch
node_plugin_management -->|"creates client"| node_docker_client
node_database_start -->|"starts container"| node_container_ops
node_database_start -->|"waits for connection"| node_elasticsearch
node_container_ops -->|"uses client"| node_docker_client
node_image_ops -->|"uses client"| node_docker_client
node_other_commands -.->|"starts UI"| node_ui_start
node_ui_start -->|"starts container"| node_container_ops
node_ui_start -->|"starts Kibana"| node_kibana
node_kibana -.->|"views scan results"| node_elasticsearch
node_other_commands -.->|"serves API"| node_api

click node_cli "https://github.com/maliceio/malice/blob/master/main.go"
click node_scan "https://github.com/maliceio/malice/blob/master/commands/scan.go"
click node_other_commands "https://github.com/maliceio/malice/tree/master/commands"
click node_api "https://github.com/maliceio/malice/tree/master/api/server"
click node_file_info "https://github.com/maliceio/malice/blob/master/malice/persist/file.go"
click node_sample_store "https://github.com/maliceio/malice/blob/master/malice/persist/filestore.go"
click node_plugin_dispatch "https://github.com/maliceio/malice/blob/master/plugins/plugins.go"
click node_plugin_management "https://github.com/maliceio/malice/blob/master/commands/plugin.go"
click node_docker_client "https://github.com/maliceio/malice/blob/master/malice/docker/client/client.go"
click node_container_ops "https://github.com/maliceio/malice/blob/master/malice/docker/client/container/run.go"
click node_image_ops "https://github.com/maliceio/malice/blob/master/malice/docker/client/image/image.go"
click node_database_start "https://github.com/maliceio/malice/blob/master/malice/database/database.go"
click node_plugin_containers "https://github.com/maliceio/malice/blob/master/plugins/plugins.go"
click node_ui_start "https://github.com/maliceio/malice/blob/master/malice/ui/ui.go"

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_scan,node_other_commands,node_api toneBlue
class node_file_info,node_sample_store,node_plugin_dispatch,node_plugin_management toneAmber
class node_docker_client,node_container_ops,node_image_ops,node_database_start,node_plugin_containers toneMint
class node_elasticsearch,node_ui_start,node_kibana toneRose
class node_user toneIndigo
```

## Components

### CLI and API

- [Malice CLI](https://github.com/maliceio/malice/blob/master/main.go): `main.go`
- [Scan workflow](https://github.com/maliceio/malice/blob/master/commands/scan.go): `commands/scan.go`
- [Other commands](https://github.com/maliceio/malice/tree/master/commands): `commands`
- [HTTP API](https://github.com/maliceio/malice/tree/master/api/server): `api/server`

### Sample analysis

- [File metadata](https://github.com/maliceio/malice/blob/master/malice/persist/file.go): `malice/persist/file.go`
- [Sample volume](https://github.com/maliceio/malice/blob/master/malice/persist/filestore.go): `malice/persist/filestore.go`
- [Plugin dispatch](https://github.com/maliceio/malice/blob/master/plugins/plugins.go): `plugins/plugins.go`
- [Plugin management](https://github.com/maliceio/malice/blob/master/commands/plugin.go): `commands/plugin.go`

### Docker runtime

- [Docker client](https://github.com/maliceio/malice/blob/master/malice/docker/client/client.go): `malice/docker/client/client.go`
- [Container operations](https://github.com/maliceio/malice/blob/master/malice/docker/client/container/run.go): `malice/docker/client/container/run.go`
- [Image operations](https://github.com/maliceio/malice/blob/master/malice/docker/client/image/image.go): `malice/docker/client/image/image.go`
- [Elasticsearch startup](https://github.com/maliceio/malice/blob/master/malice/database/database.go): `malice/database/database.go`
- [Analysis plugins](https://github.com/maliceio/malice/blob/master/plugins/plugins.go): `plugins/plugins.go`

### Results and UI

- **Elasticsearch**
- [Kibana startup](https://github.com/maliceio/malice/blob/master/malice/ui/ui.go): `malice/ui/ui.go`
- **Kibana UI**

### Other components

- **Researcher**

## Connections

- Researcher → Malice CLI: runs commands
- Malice CLI → Scan workflow: dispatches scan (evidence: `main.go`)
- Malice CLI → Other commands: dispatches commands (evidence: `main.go`)
- Scan workflow → Docker client: creates client (evidence: `commands/scan.go`)
- Scan workflow → Container operations: cleans containers (evidence: `commands/scan.go`)
- Scan workflow → Elasticsearch startup: starts database (evidence: `commands/scan.go`)
- Scan workflow → File metadata: reads sample (evidence: `commands/scan.go`)
- Scan workflow → Sample volume: copies sample (evidence: `commands/scan.go`)
- Scan workflow → Elasticsearch: stores file info (evidence: `commands/scan.go`)
- Scan workflow → Plugin dispatch: runs plugins (evidence: `commands/scan.go`)
- Plugin dispatch → Analysis plugins: starts plugins (evidence: `plugins/plugins.go`)
- Analysis plugins → Container operations: starts containers (evidence: `plugins/plugins.go`)
- Plugin management → Plugin dispatch: manages plugins (evidence: `commands/plugin.go`)
- Plugin management → Docker client: creates client (evidence: `commands/plugin.go`)
- Elasticsearch startup → Container operations: starts container (evidence: `malice/database/database.go`)
- Elasticsearch startup → Elasticsearch: waits for connection (evidence: `malice/database/database.go`)
- Container operations → Docker client: uses client (evidence: `malice/docker/client/container/run.go`)
- Image operations → Docker client: uses client (evidence: `malice/docker/client/image/image.go`)
- Other commands → Kibana startup: starts UI
- Kibana startup → Container operations: starts container (evidence: `malice/ui/ui.go`)
- Kibana startup → Kibana UI: starts Kibana (evidence: `malice/ui/ui.go`)
- Kibana UI → Elasticsearch: views scan results
- Other commands → HTTP API: serves API
