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)