From 4bb6afb24efb8d72f833da11566146a2ff1d369e Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 20 Jun 2018 14:52:11 -0500 Subject: [PATCH] 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. --- .../windows/smb/ms17_010_eternalblue_win8.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py b/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py index 72cd8373b2..eace84644c 100755 --- a/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py +++ b/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py @@ -8,9 +8,9 @@ from base64 import b64decode try: from impacket import smb, ntlm except ImportError: - no_impacket = True + dependencies_missing = True else: - no_impacket = False + dependencies_missing = False from metasploit import module @@ -647,6 +647,10 @@ def _exploit(target, port, feaList, shellcode, numGroomConn, username, password) 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 rport = int(args['RPORT']) numGroomConn = int(args['GroomAllocations']) @@ -671,8 +675,4 @@ def exploit(args): if __name__ == '__main__': - if no_impacket: - module.log('Please install Impacket before continuing', 'error') - sys.exit(1) - module.run(metadata, exploit)