metasploit/msf/async/
modules.rs1#![allow(non_camel_case_types)]
2#![allow(unused_assignments)]
3use crate::client::Client;
4use std::collections::HashMap;
5use crate::error::Error as E;
6use serde::de::DeserializeOwned as DOwned;
7#[path="../blocking/modules.rs"] mod modules;
8
9pub struct compactible {
10 pub name:String,
11 pub client:Client,
12}
13pub struct list {
14 pub client:Client,
15}
16impl list {
17 pub fn new(client:Client) -> Self {
18 list {
19 client:client,
20 }
21 }
22 pub async fn exploits<T:DOwned>(&self) -> Result<T,E> {
23 let list=modules::list::new(self.client.clone());
24 list.exploits()
25 }
26 pub async fn auxiliary<T:DOwned>(&self) -> Result<T,E> {
27 let list=modules::list::new(self.client.clone());
28 list.auxiliary()
29 }
30 pub async fn post<T:DOwned>(&self) -> Result<T,E> {
31 let list=modules::list::new(self.client.clone());
32 list.post()
33 }
34 pub async fn payloads<T:DOwned>(&self) -> Result<T,E> {
35 let list=modules::list::new(self.client.clone());
36 list.payloads()
37 }
38 pub async fn encoders<T:DOwned>(&self) -> Result<T,E> {
39 let list=modules::list::new(self.client.clone());
40 list.encoders()
41 }
42 pub async fn nops<T:DOwned>(&self) -> Result<T,E> {
43 let list=modules::list::new(self.client.clone());
44 list.nops()
45 }
46}
47pub async fn info<T:DOwned>(client:Client,moduletypestr:&str,modulenamestr:&str) -> Result<T,E> {
48 modules::info(client.clone(),moduletypestr,modulenamestr)
49}
50impl compactible {
51 pub fn new(modulename:String,client:Client) -> Self {
52 compactible {
53 name:modulename,
54 client:client,
55 }
56 }
57 pub async fn payload<T:DOwned>(&self) -> Result<T,E> {
58 let list=modules::compactible::new(self.name.clone(),self.client.clone());
59 list.payload()
60 }
61 pub async fn target_payloads<T:DOwned>(&self,targetindx:i32) -> Result<T,E> {
62 let list=modules::compactible::new(self.name.clone(),self.client.clone());
63 list.target_payloads(targetindx)
64 }
65 pub async fn sessions<T:DOwned>(&self) -> Result<T,E> {
66 let list=modules::compactible::new(self.name.clone(),self.client.clone());
67 list.sessions()
68 }
69}
70pub async fn option<T:DOwned>(client:Client,moduletypestr:&str,modulenamestr:&str) -> Result<T,E> {
71 modules::option(client.clone(),moduletypestr,modulenamestr)
72}
73pub async fn encoder<T:DOwned>(client:Client,datastr:&str,encodermodulestr:&str,options:HashMap<String,String>) -> Result<T,E> {
74 modules::encoder(client.clone(),datastr,encodermodulestr,options)
75}
76pub async fn execute<T:DOwned>(client:Client,moduletypestr:&str,modulenamestr:&str,options:HashMap<String,String>) -> Result<T,E> {
77 modules::execute(client.clone(),moduletypestr,modulenamestr,options)
78}