Files
mimic-big/backend
knacky 35c3823ac7 feat(backend): add C2Connector ABC + payload mapping + factory (B0.4)
- abstract C2Connector with authenticate / list_hosts / execute_task /
  get_task_result / cancel_task / execute_cleanup; stream_task_output
  optional v1 (NotImplementedError).
- Payload / TaskHandle / TaskResult / TaskStatus frozen dataclasses.
- UnsupportedPayloadType raised when no native command maps to the
  chosen (c2_type, payload_type) pair.
- Mythic payload_type → native command map populated (spec §7 table).
- HOME map left empty until PR2 is closed.
- ConnectorFactory: register_connector decorator + build(c2_type) that
  instantiates + authenticates via an injected config resolver.

No real Mythic / Home implementations land in this sprint.
2026-05-21 20:33:06 +02:00
..

Mimic — backend

Sprint 0 skeleton. Python 3.12+ / Flask / SQLAlchemy 2 / Alembic / Pydantic 2.

Layout

backend/
├── src/mimic/
│   ├── app.py                # Flask app factory + SocketIO init
│   ├── config.py             # Pydantic Settings
│   ├── extensions.py         # db, migrate, socketio, login_manager
│   ├── db/
│   │   ├── models/           # SQLAlchemy 2 typed models
│   │   ├── repositories/     # data access per aggregate
│   │   └── migrations/       # Alembic
│   ├── schemas/              # Pydantic 2 DTOs
│   ├── api/                  # Flask blueprints (REST)
│   ├── ws/                   # Flask-SocketIO namespaces
│   ├── connectors/           # C2Connector ABC + payload mapping
│   ├── orchestrator/         # run state machine (stub in sprint 0)
│   ├── templating/           # Jinja2 sandbox + regex_extract
│   ├── audit/                # append-only writer + rotation
│   ├── reporting/            # WeasyPrint builder (stub in sprint 0)
│   ├── rbac/                 # group-based permission matrix (F11)
│   ├── importers/            # ATR + C2 journal (stub in sprint 0)
│   └── cli/                  # mimic-cli (click)
└── tests/
    ├── unit/                 # SQLite, pure logic
    └── integration/          # testcontainers Postgres

Local dev

make install      # uv venv + pip install -e .[dev]
make db-up        # docker compose up -d postgres
make db-migrate   # alembic upgrade head
make run          # flask run (debug)
make test         # pytest unit
make test-int     # pytest integration (testcontainers)
make lint         # ruff + mypy strict

What sprint 0 ships

  • Full §8 data model + Alembic initial migration (Postgres-specific constraints: audit_log write-only role, soc_session hash, c2_credential Fernet column).
  • C2Connector ABC + dataclasses + payload_type enum + factory. No real Mythic/Home implementation (blocked on PR1/PR2).
  • Jinja2 SandboxedEnvironment + regex_extract filter (re2).
  • Local auth (bcrypt + Flask session) + group-based RBAC matching the F11 permission matrix.
  • Flat CRUD on engagements / hosts / TTPs / scenarios.
  • pytest baseline + testcontainers Postgres scaffolding.

Out of sprint 0

Orchestrator, WebSocket cockpit, real connectors, report generation, audit rotation.