Executing API calls

The call method allows us to call API elements from within Metasploit that are surfaced through the msgrpc interface. For the first example, we will request the list of all exploits form the server. To do this, we call the module.exploits function:

# Get a list of the exploits from the server mod = client.call('module.exploits')

If we want to find all of the payloads that were compatible, we could call the module.compatible_payloads method to find the payloads compatible with our exploit:

# Get the list of compatible payloads for the first option ret = client.call('module.compatible_payloads',[mod['modules'][0]])

If this example, we are obtaining this information and getting the list of compatible payloads for the first ...

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.