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 [ModuleType, ModuleName] on
all supported framework releases. A modern server answers with a rich
metadata map for known modules and an error map ― classifiable as
“module not found” or an RPC failure ― for unknown ones. Only very old
frameworks still expect the single full-name signature; when the modern
response signals an argument-shape mismatch (rather than a missing
module) we fall back to that form once.
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.
Mirrors the module.info lookup logic (modern form first, legacy
single-name fallback reserved for servers that reject the modern one).
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
Auto Trait Implementations§
impl Freeze for MsfRpcClient
impl RefUnwindSafe for MsfRpcClient
impl Send for MsfRpcClient
impl Sync for MsfRpcClient
impl Unpin for MsfRpcClient
impl UnsafeUnpin for MsfRpcClient
impl UnwindSafe for MsfRpcClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more