mythic-c2
Mythic C2 agent protocol library for Rust — message encoding/decoding, AES-256-CBC-HMAC encryption, and a transport abstraction layer.
#![no_std] compatible with alloc, suitable for embedded agent binaries.
Quick Start
use ;
use Uuid;
let agent_uuid = parse_str.unwrap;
let crypto = new;
let mut mythic = with_crypto;
// Build a checkin packet — ready to send
let pkt = mythic.build_checkin.unwrap;
// → Base64( UUID + AES256( JSON({ "action": "checkin", ... }) ) )
Two API Levels
Mythic facade — holds UUID and crypto, one call per operation:
let mythic = with_crypto;
let pkt = mythic.build_checkin?;
let = mythic.parse_checkin?;
mythic.set_agent_uuid; // switch to callback UUID
Free functions — full control over every step:
let req = new;
let pkt = encode_message?;
let = ?;
C2Transport Trait
Implement C2Transport for any transport (HTTP, DNS, WebSocket, etc.):
use C2Transport;
;
Then use combined methods:
let = mythic.checkin?;
Three Communication Scenarios
| Scenario | Init | Checkin |
|---|---|---|
| Plaintext | Mythic::new(uuid) |
build_checkin() — no encryption |
| Static key | Mythic::with_crypto(uuid, key) |
build_checkin() — AES encrypted |
| RSA EKE | Mythic::with_crypto(uuid, aes_psk) → staging → set_crypto(…) |
build_checkin() — negotiated key |
See examples/mythic_facade.rs for the full agent lifecycle.
License
GPL-3.0-only