Skip to main content

mythic/
lib.rs

1//! # mythic-c2
2//!
3//! Mythic C2 agent protocol library — message encoding/decoding,
4//! AES-256-CBC-HMAC encryption, and transport abstraction.
5//!
6//! ## Quick Example
7//!
8//! ```no_run
9//! use mythic::{C2Transport, MythicAgent, MythicError};
10//! use uuid::Uuid;
11//!
12//! # struct HttpC2;
13//! # impl C2Transport for HttpC2 {
14//! #     fn checkin(&self, p: &str) -> Result<String, MythicError> { Ok(String::new()) }
15//! #     fn get_tasking(&self, p: &str) -> Result<String, MythicError> { Ok(String::new()) }
16//! #     fn post_response(&self, p: &str) -> Result<String, MythicError> { Ok(String::new()) }
17//! # }
18//! let mut c2 = HttpC2;
19//! let payload_uuid = Uuid::parse_str("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee").unwrap();
20//!
21//! let agent = MythicAgent::easy_checkin(
22//!     payload_uuid,
23//!     &mut c2,
24//!     vec!["10.0.0.1".into()],
25//!     Some("linux".into()),
26//!     Some("root".into()),
27//!     Some("web01".into()),
28//!     Some(1337),
29//!     Some("x86_64".into()),
30//!     None, None, None, None, None, None,
31//! )
32//! .unwrap();
33//!
34//! println!("callback UUID: {}", agent.callback_uuid());
35//! ```
36
37pub mod agent;
38pub mod error;
39pub mod protocol;
40pub mod transport;
41
42pub use agent::MythicAgent;
43pub use error::{MythicError, MythicResult};
44pub use protocol::*;
45pub use transport::C2Transport;
46
47#[cfg(any(
48    feature = "http",
49    feature = "httpx",
50    feature = "dns",
51    feature = "websocket",
52    feature = "github"
53))]
54pub use transport::config::{C2Profile, C2Profiles};