From 13a4b2e359585aedda426937c4e464a90226f06f Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 20 Jun 2018 12:22:17 -0500 Subject: [PATCH] Add dependency check for Impacket --- .../windows/smb/ms17_010_eternalblue_win8.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py b/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py index 0c6781a6a8..9dd3a3a784 100755 --- a/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py +++ b/modules/exploits/windows/smb/ms17_010_eternalblue_win8.py @@ -1,11 +1,18 @@ #!/usr/bin/env python2.7 -from metasploit import module -from impacket import smb, ntlm -from struct import pack -from base64 import b64decode import sys import socket +from struct import pack +from base64 import b64decode + +try: + from impacket import smb, ntlm +except ImportError: + no_impacket = True +else: + no_impacket = False + +from metasploit import module metadata = { 'name': 'MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption for Win8+', @@ -664,4 +671,8 @@ def exploit(args): if __name__ == '__main__': + if no_impacket: + module.log('Please install Impacket before continuing', 'error') + sys.exit(1) + module.run(metadata, exploit)