From 4619a614656d01c48c8ef7150ceebc117118e060 Mon Sep 17 00:00:00 2001 From: Noam Rathaus Date: Tue, 5 Mar 2024 10:00:14 +0200 Subject: [PATCH] Add missing rpc commands --- pymetasploit3/msfrpc.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/pymetasploit3/msfrpc.py b/pymetasploit3/msfrpc.py index f0e33a2..edde7fa 100755 --- a/pymetasploit3/msfrpc.py +++ b/pymetasploit3/msfrpc.py @@ -129,16 +129,19 @@ class MsfRpcMethod(object): ModuleNops = 'module.nops' ModulePlatforms = 'module.platforms' ModulePost = 'module.post' + ModuleInfoHTML = 'module.info_html' ModuleInfo = 'module.info' ModuleCompatiblePayloads = 'module.compatible_payloads' + ModuleCompatibleEvasionPayloads = 'module.compatible_evasion_payloads' ModuleCompatibleSessions = 'module.compatible_sessions' ModuleTargetCompatiblePayloads = 'module.target_compatible_payloads' + ModuleTargetCompatibleEvasionPayloads = 'module.target_compatible_evasion_payloads' ModuleOptions = 'module.options' ModuleExecute = 'module.execute' ModuleEncodeFormats = 'module.encode_formats' ModuleEncode = 'module.encode' ModuleSearch = 'module.search' - ModuleCompatibleSessions = 'module.compatible_sessions' + ModuleRunningStats = 'module.running_stats' ModuleCheck = 'module.check' ModuleResults = 'module.results' PluginLoad = 'plugin.load' @@ -1517,6 +1520,14 @@ def payloads(self): # return self.rpc.call(MsfRpcMethod.ModuleCompatiblePayloads, self.modulename)['payloads'] return self.targetpayloads(self.target) + @property + def evasion_payloads(self): + """ + A list of compatible evasion payloads. + """ + return self.rpc.call(MsfRpcMethod.ModuleCompatibleEvasionPayloads, self.modulename) + + @property def target(self): return self._target @@ -1536,6 +1547,15 @@ def targetpayloads(self, t=0): """ return self.rpc.call(MsfRpcMethod.ModuleTargetCompatiblePayloads, [self.modulename, t])['payloads'] + def targetevasionpayloads(self, t=0): + """ + Returns a list of compatible evasion payloads for a given target ID. + + Optional Keyword Arguments: + - t : the target ID (default: 0, e.g. 'Automatic') + """ + return self.rpc.call(MsfRpcMethod.ModuleTargetCompatibleEvasionPayloads, [self.modulename, t])['payloads'] + class PostModule(MsfModule): @@ -1678,6 +1698,24 @@ def check(self, mtype, mname, **kwargs): - **kwargs : the module's run options """ return self.rpc.call(MsfRpcMethod.ModuleCheck, [mtype, mname, kwargs]) + + def running_stats(self): + """ + Returns the currently running module stats in each state. + """ + + return self.rpc.call(MsfRpcMethod.ModuleRunningStats, []) + + def info_html(self, mtype, mname): + """ + Returns detailed information about a module in HTML. + + Mandatory Arguments: + - mtype : Module type + - mname : Module name + """ + + return self.rpc.call(MsfRpcMethod.ModuleInfoHTML, [mtype, mname]) def results(self, uuid): return self.rpc.call(MsfRpcMethod.ModuleResults, [uuid])