DanMcInerney / pymetasploit3

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

How can i run ‘check’ with pymetasploit3? #59

Closed yanjy14 closed 3 years ago

yanjy14 commented 4 years ago

Some exploits have 'check' function. I want to konw how i can use it.

goguma-chsong commented 4 years ago
exploit = client.modules.use('path/to/module/')

# 
# Set Your Options Here
#

c = exploit.check()  # c will be uuid of job

res = client.modules.results(c) # return result of job

if res['status'] == 'completed':
    if res['status']['code'] == 'vulnerable':
        print("This is vulnerable")

You can use check module in this way exploit.check() returns uuid of executed job.

You can check this job result by using client.modules.result(uuid) If the result status is completed, the check result code will be returned to you.

you should wait until the job is completed