Skip to content

Commit 1c55fd8

Browse files
committed
fix ruff
1 parent 02981b1 commit 1c55fd8

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

nxc/protocols/ldap.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,21 @@
1414
from OpenSSL.SSL import SysCallError
1515
from bloodhound.ad.authentication import ADAuthentication
1616
from bloodhound.ad.domain import AD
17-
from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP
18-
from impacket.dcerpc.v5.rpcrt import DCERPCException, RPC_C_AUTHN_GSS_NEGOTIATE
1917
from impacket.dcerpc.v5.samr import (
2018
UF_ACCOUNTDISABLE,
2119
UF_DONT_REQUIRE_PREAUTH,
2220
UF_TRUSTED_FOR_DELEGATION,
2321
UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION,
2422
UF_SERVER_TRUST_ACCOUNT,
2523
)
26-
from impacket.dcerpc.v5.transport import DCERPCTransportFactory
2724
from impacket.krb5 import constants
2825
from impacket.krb5.kerberosv5 import getKerberosTGS, SessionKeyDecryptionError
2926
from impacket.krb5.types import Principal, KerberosException
3027
from impacket.ldap import ldap as ldap_impacket
3128
from impacket.ldap import ldaptypes
3229
from impacket.ldap import ldapasn1 as ldapasn1_impacket
3330
from impacket.ldap.ldap import LDAPFilterSyntaxError
34-
from impacket.smbconnection import SMBConnection, SessionError
31+
from impacket.smbconnection import SessionError
3532
from impacket.ntlm import getNTLMSSPType1
3633

3734
from nxc.config import process_secret, host_info_colors
@@ -238,13 +235,13 @@ def enum_host_info(self):
238235

239236
ntlm_challenge = None
240237
bindRequest = ldapasn1_impacket.BindRequest()
241-
bindRequest['version'] = 3
242-
bindRequest['name'] = ""
238+
bindRequest["version"] = 3
239+
bindRequest["name"] = ""
243240
negotiate = getNTLMSSPType1()
244-
bindRequest['authentication']['sicilyNegotiate'] = negotiate.getData()
241+
bindRequest["authentication"]["sicilyNegotiate"] = negotiate.getData()
245242
try:
246-
response = self.ldap_connection.sendReceive(bindRequest)[0]['protocolOp']
247-
ntlm_challenge = bytes(response['bindResponse']['matchedDN'])
243+
response = self.ldap_connection.sendReceive(bindRequest)[0]["protocolOp"]
244+
ntlm_challenge = bytes(response["bindResponse"]["matchedDN"])
248245
except Exception as e:
249246
self.logger.debug(f"Failed to get target {self.host} ntlm challenge, error: {e!s}")
250247

0 commit comments

Comments
 (0)