DanMcInerney / pymetasploit3

Automation library for Metasploit
MIT License
373 stars 92 forks source link

How can i get / see 'exploit uuid' while executing with "run_module_with_output" #18

Open mmali277 opened 5 years ago

mmali277 commented 5 years ago

I want to get the exploit uuid which in case of exploit.execute is following:


>>> exploit.execute(payload='cmd/unix/interact')
{'job_id': 1, 'uuid': '3whbuevf'}
>>>

but when running with output, that is

(client.consoles.console(cid).run_module_with_output(exploit, payload='cmd/unix/interact'))

there is no such type of dictionary available. What i actually want to do is match the 'uuid' (as given by exploit.execute()) with the 'exploit uuid' with any of the available sessions from sessions list client.sessions.list

for example: in case of exploit.execute() :

>>> exploit.execute(payload='cmd/unix/interact')
{'job_id': 1, 'uuid': '3whbuevf'}
>>>

>>> client.sessions.list
{1: {'info': '', 'username': 'jsmith', 'session_port': 21, 'via_payload': 'payload/cmd/unix/interact',
'uuid': '5orqnnyv', 'tunnel_local': '172.16.14.1:58429', 'via_exploit': 'exploit/unix/ftp/vsftpd_234_backdoor',
'exploit_uuid': '3whbuevf', 'tunnel_peer': '172.16.14.145:6200', 'workspace': 'false', 'routes': '',
'target_host': '172.16.14.145', 'type': 'shell', 'session_host': '172.16.14.145', 'desc': 'Command shell'}}
>>>

the 'uuid' of exploit.execute() and 'exploit_uuid' of session:1 from client.sessions.list matches.

That is what i want to do with (client.consoles.console(cid).run_module_with_output(exploit, payload='cmd/unix/interact'))

DanMcInerney commented 5 years ago

Hmm, I'll have to think about how to implement this one. Not sure just yet.