# digiprosec/microtrick architecture

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

- Interactive diagram: https://gitdiagram.com/digiprosec/microtrick
- Repository: https://github.com/digiprosec/microtrick

## Overview

MikroTrick is a single-file Python lab client that turns a RouterOS SSH connection into an unauthenticated administrator console, then either runs a supplied command or plants a test account. The main flow validates the target, performs the authentication/rekey/channel/policy-mask exploit, and uses the resulting console. Interactive terminal relay is an alternate mode implemented in the same file. The README and source excerpt support these relationships; the repository has no separate runtime modules.

Main entry points: [`poc_mikrotrick.py`](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py) (CLI Orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation"]
  node_main["CLI Orchestrator<br/>[poc_mikrotrick.py]"]
  node_target_check["Target Check<br/>[poc_mikrotrick.py]"]
end

subgraph group_exploit["SSH Exploit"]
  node_exploit_flow["Exploit Flow<br/>[poc_mikrotrick.py]"]
end

subgraph group_console["Console Actions"]
  node_console_run["Command Runner<br/>[poc_mikrotrick.py]"]
  node_interactive["Terminal Relay<br/>[poc_mikrotrick.py]"]
  node_account["Test Account Setup<br/>[poc_mikrotrick.py]"]
end

node_operator(("Operator"))
node_routeros{{"RouterOS SSH"}}

node_operator -->|"invokes"| node_main
node_main -->|"validates target"| node_target_check
node_main -->|"starts exploit"| node_exploit_flow
node_exploit_flow -->|"exploits over SSH"| node_routeros
node_exploit_flow -->|"returns channel"| node_main
node_main -->|"runs command"| node_console_run
node_main -->|"plants account"| node_account
node_account -->|"uses runner"| node_console_run
node_main -->|"relays terminal"| node_interactive
node_console_run -->|"sends commands"| node_routeros
node_routeros -->|"returns output"| node_console_run
node_interactive -->|"relays channel data"| node_routeros

click node_main "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py"
click node_target_check "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py"
click node_exploit_flow "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py"
click node_console_run "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py"
click node_interactive "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py"
click node_account "https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.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_main,node_target_check toneBlue
class node_exploit_flow toneAmber
class node_console_run,node_interactive,node_account,node_routeros toneMint
class node_operator toneIndigo
```

## Components

### Invocation

- [CLI Orchestrator](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`
- [Target Check](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`

### SSH Exploit

- [Exploit Flow](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`

### Console Actions

- [Command Runner](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`
- [Terminal Relay](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`
- [Test Account Setup](https://github.com/digiprosec/microtrick/blob/main/poc_mikrotrick.py): `poc_mikrotrick.py`

### Other components

- **Operator**
- **RouterOS SSH**

## Connections

- Operator → CLI Orchestrator: invokes (evidence: `poc_mikrotrick.py`)
- CLI Orchestrator → Target Check: validates target (evidence: `poc_mikrotrick.py`)
- CLI Orchestrator → Exploit Flow: starts exploit (evidence: `poc_mikrotrick.py`)
- Exploit Flow → RouterOS SSH: exploits over SSH (evidence: `poc_mikrotrick.py`)
- Exploit Flow → CLI Orchestrator: returns channel (evidence: `poc_mikrotrick.py`)
- CLI Orchestrator → Command Runner: runs command (evidence: `poc_mikrotrick.py`)
- CLI Orchestrator → Test Account Setup: plants account (evidence: `poc_mikrotrick.py`)
- Test Account Setup → Command Runner: uses runner (evidence: `poc_mikrotrick.py`)
- CLI Orchestrator → Terminal Relay: relays terminal (evidence: `poc_mikrotrick.py`)
- Command Runner → RouterOS SSH: sends commands (evidence: `poc_mikrotrick.py`)
- RouterOS SSH → Command Runner: returns output (evidence: `poc_mikrotrick.py`)
- Terminal Relay → RouterOS SSH: relays channel data (evidence: `poc_mikrotrick.py`)
