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§
fn name(&self) -> &'static str
fn workspace(&self) -> &str
fn set_workspace(&mut self, workspace: &str)
Sourcefn connect(&mut self) -> Result<()>
fn connect(&mut self) -> Result<()>
Verify connectivity and authenticate. Should be cheap when the client already holds a valid token.
fn disconnect(&mut self)
fn is_connected(&self) -> bool
Sourcefn module_info(&mut self, module_type: &str, name: &str) -> Result<ModuleInfo>
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.
Sourcefn run_module(
&mut self,
module_type: &str,
name: &str,
options: &BTreeMap<String, String>,
payload: Option<&str>,
) -> Result<ModuleRunResult>
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.
Sourcefn monitor_job(&mut self, job_id: &str, timeout: Duration) -> Result<JobStatus>
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.
Sourcefn list_sessions(&mut self) -> Result<Vec<SessionInfo>>
fn list_sessions(&mut self) -> Result<Vec<SessionInfo>>
List current sessions.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".