Move dependency check so we can send our metadata

I missed this detail about the module.run method when adding the check.
Defining the metadata or where you put it doesn't matter so much as if
you're sending it over JSON-RPC.
GSoC/Meterpreter_Web_Console
William Vu 2018-06-20 14:52:11 -05:00
parent 8277a4da24
commit 4bb6afb24e
1 changed files with 6 additions and 6 deletions

View File

@ -8,9 +8,9 @@ from base64 import b64decode
try: try:
from impacket import smb, ntlm from impacket import smb, ntlm
except ImportError: except ImportError:
no_impacket = True dependencies_missing = True
else: else:
no_impacket = False dependencies_missing = False
from metasploit import module from metasploit import module
@ -647,6 +647,10 @@ def _exploit(target, port, feaList, shellcode, numGroomConn, username, password)
def exploit(args): def exploit(args):
if dependencies_missing:
module.log('Module dependencies (impacket) missing, cannot continue', 'error')
return
# XXX: Normalize strings to ints and unset options to empty strings # XXX: Normalize strings to ints and unset options to empty strings
rport = int(args['RPORT']) rport = int(args['RPORT'])
numGroomConn = int(args['GroomAllocations']) numGroomConn = int(args['GroomAllocations'])
@ -671,8 +675,4 @@ def exploit(args):
if __name__ == '__main__': if __name__ == '__main__':
if no_impacket:
module.log('Please install Impacket before continuing', 'error')
sys.exit(1)
module.run(metadata, exploit) module.run(metadata, exploit)