Skip to main content

ExploitFramework

Trait ExploitFramework 

Source
pub trait ExploitFramework: Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn workspace(&self) -> &str;
    fn set_workspace(&mut self, workspace: &str);
    fn connect(&mut self) -> Result<()>;
    fn disconnect(&mut self);
    fn is_connected(&self) -> bool;
    fn module_info(
        &mut self,
        module_type: &str,
        name: &str,
    ) -> Result<ModuleInfo>;
    fn run_module(
        &mut self,
        module_type: &str,
        name: &str,
        options: &BTreeMap<String, String>,
        payload: Option<&str>,
    ) -> Result<ModuleRunResult>;
    fn monitor_job(
        &mut self,
        job_id: &str,
        timeout: Duration,
    ) -> Result<JobStatus>;
    fn list_sessions(&mut self) -> Result<Vec<SessionInfo>>;
    fn list_loot(&mut self) -> Result<Vec<LootInfo>>;
}
Expand description

A framework-agnostic exploitation backend.

The CLI and database layers only ever talk to this trait; Metasploit is one implementation behind it. This keeps the command and its history records reusable if a different framework is added later.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn workspace(&self) -> &str

Source

fn set_workspace(&mut self, workspace: &str)

Source

fn connect(&mut self) -> Result<()>

Verify connectivity and authenticate. Should be cheap when the client already holds a valid token.

Source

fn disconnect(&mut self)

Source

fn is_connected(&self) -> bool

Source

fn module_info(&mut self, module_type: &str, name: &str) -> Result<ModuleInfo>

Fetch full module metadata. Backends return an error whose variant is AppError::RpcModuleNotFound when the module does not exist, so callers can tell “missing” apart from a genuine RPC failure.

Source

fn run_module( &mut self, module_type: &str, name: &str, options: &BTreeMap<String, String>, payload: Option<&str>, ) -> Result<ModuleRunResult>

Launch a module with fully resolved options.

Source

fn monitor_job(&mut self, job_id: &str, timeout: Duration) -> Result<JobStatus>

Poll a background job until it settles, timeout expires, or the optional deadline is reached.

Source

fn list_sessions(&mut self) -> Result<Vec<SessionInfo>>

List current sessions.

Source

fn list_loot(&mut self) -> Result<Vec<LootInfo>>

List loot for the active workspace.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§