Skip to content

Commit

Permalink
Merge pull request #105 from nrathaus/add_missing_rpcs
Browse files Browse the repository at this point in the history
Add missing rpc commands
  • Loading branch information
DanMcInerney authored Apr 5, 2024
2 parents cec90f4 + 4619a61 commit f3b7e4b
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion pymetasploit3/msfrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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):

Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit f3b7e4b

Please sign in to comment.