pub struct MsfRpcClient { /* private fields */ }Implementations§
Source§impl MsfRpcClient
impl MsfRpcClient
pub fn new( host: &str, port: u16, username: &str, password: &str, ssl: bool, ) -> Self
pub fn login(&mut self) -> Result<MSFLoginResult>
pub fn logout(&mut self)
pub fn is_authenticated(&self) -> bool
pub fn get_workspaces(&self) -> Result<MSFWorkspacesResult>
pub fn get_hosts(&self, workspace: Option<&str>) -> Result<MSFHostsResult>
pub fn check_host_exists( &self, address: &str, workspace: Option<&str>, ) -> Result<MSFHostCheckResult>
Sourcepub fn rpc_call(
&self,
method: &str,
params: &[MsgValue],
timeout_secs: u64,
) -> Result<MsgValue>
pub fn rpc_call( &self, method: &str, params: &[MsgValue], timeout_secs: u64, ) -> Result<MsgValue>
Generic authenticated RPC call: [method, token, ...params].
Used by the exploitation layer for module discovery, execution and job monitoring. Returns the raw msgpack response so the caller can map it to strongly typed models.
Sourcepub fn module_exists(&self, module_type: &str, name: &str) -> Result<bool>
pub fn module_exists(&self, module_type: &str, name: &str) -> Result<bool>
Verify that a module exists on the connected Metasploit instance.
module_type is exploit, auxiliary or post.
Distinguishes three outcomes: the module exists (Ok(true)), it does
not exist (Ok(false)), or the lookup itself failed (Err).
Sourcepub fn module_info(&self, module_type: &str, name: &str) -> Result<MsgValue>
pub fn module_info(&self, module_type: &str, name: &str) -> Result<MsgValue>
Fetch full module metadata via module.info.
The RPC module.info handler accepts both [ModuleType, ModuleName]
(modern signature) and a single full ModuleName (legacy signature).
We send the modern form first and transparently fall back to the legacy
form so the same code works across framework releases.
Sourcepub fn module_options(&self, module_type: &str, name: &str) -> Result<MsgValue>
pub fn module_options(&self, module_type: &str, name: &str) -> Result<MsgValue>
Fetch the datastore options for a module via module.options.
Modern servers accept [ModuleType, ModuleName]; legacy servers accept
a single module name, so we mirror the module.info fallback.
Sourcepub fn list_modules_for_type(&self, module_type: &str) -> Result<Vec<MSFModule>>
pub fn list_modules_for_type(&self, module_type: &str) -> Result<Vec<MSFModule>>
List every module of the given RPC type currently loaded by the
instance. Returns full refnames including the type prefix, e.g.
auxiliary/scanner/http/robots_txt.
RPC listing methods take no arguments; passing a module name to them is ignored (or rejected by stricter servers) and would never be a valid existence probe.
Sourcepub fn list_modules(&self) -> Result<Vec<MSFModule>>
pub fn list_modules(&self) -> Result<Vec<MSFModule>>
Load the union of all exploit, auxiliary and post modules known to the connected instance. Used by the process pipeline so suggestions are grounded in what the instance can actually run.
Sourcepub fn module_execute(
&self,
module_type: &str,
name: &str,
options: &BTreeMap<String, String>,
payload: Option<&str>,
) -> Result<MsgValue>
pub fn module_execute( &self, module_type: &str, name: &str, options: &BTreeMap<String, String>, payload: Option<&str>, ) -> Result<MsgValue>
Execute a module. Returns a map containing job_id on success or an
error payload on failure.
Sourcepub fn job_list(&self) -> Result<MsgValue>
pub fn job_list(&self) -> Result<MsgValue>
List all running jobs. Response map: { "jobs": { "0": {...}, ... } }.
Sourcepub fn session_list(&self) -> Result<MsgValue>
pub fn session_list(&self) -> Result<MsgValue>
List current sessions. Response map: { "sessions": { "1": {...}, ... } }.
Trait Implementations§
Source§impl Clone for MsfRpcClient
impl Clone for MsfRpcClient
Source§fn clone(&self) -> MsfRpcClient
fn clone(&self) -> MsfRpcClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more