Skip to content

Commit 3b0f74f

Browse files
committed
cleanup the code
1 parent 3fb002c commit 3b0f74f

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

nxc/protocols/ldap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,20 @@ def check_ldaps_cbt(self):
250250
ldap_connection = ldap_impacket.LDAPConnection(url=ldap_url, baseDN=self.baseDN, dstIp=self.host)
251251
ldap_connection._LDAPConnection__channel_binding_value = None
252252
try:
253-
ldap_connection.login(user=" ",domain=self.domain)
253+
ldap_connection.login(user=" ", domain=self.domain)
254254
except ldap_impacket.LDAPSessionError as e:
255255
if str(e).find("data 80090346") >= 0:
256-
self.cbt_status = "Always" # CBT is Required
256+
self.cbt_status = "Always" # CBT is Required
257257
elif str(e).find("data 52e") >= 0:
258258
ldap_connection = ldap_impacket.LDAPConnection(url=ldap_url, baseDN=self.baseDN, dstIp=self.host)
259259
tmp = bytearray(ldap_connection._LDAPConnection__channel_binding_value)
260260
tmp[15] = (tmp[3] + 1) % 256
261261
ldap_connection._LDAPConnection__channel_binding_value = bytes(tmp)
262262
try:
263-
ldap_connection.login(user=" ",domain=self.domain)
263+
ldap_connection.login(user=" ", domain=self.domain)
264264
except ldap_impacket.LDAPSessionError as e:
265265
if str(e).find("data 80090346") >= 0:
266-
self.cbt_status = "When Supported" # CBT is When Supported
266+
self.cbt_status = "When Supported" # CBT is When Supported
267267

268268
def enum_host_info(self):
269269
self.hostname = self.target.split(".")[0].upper() if "." in self.target else self.target
@@ -320,7 +320,7 @@ def enum_host_info(self):
320320

321321
def print_host_info(self):
322322
self.logger.debug("Printing host info for LDAP")
323-
signing = colored(f"signing:Enforced", host_info_colors[0], attrs=["bold"]) if self.signing_required else colored(f"signing:None", host_info_colors[1], attrs=["bold"])
323+
signing = colored("signing:Enforced", host_info_colors[0], attrs=["bold"]) if self.signing_required else colored("signing:None", host_info_colors[1], attrs=["bold"])
324324
cbt_status = colored(f"channel binding:{self.cbt_status}", host_info_colors[3], attrs=["bold"]) if self.cbt_status == "Always" else colored(f"channel binding:{self.cbt_status}", host_info_colors[2], attrs=["bold"])
325325
ntlm = colored(f"(NTLM:{not self.no_ntlm})", host_info_colors[2], attrs=["bold"]) if self.no_ntlm else ""
326326
self.logger.extra["protocol"] = "LDAP" if str(self.port) == "389" else "LDAPS"

nxc/protocols/ldap/database.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def reflect_tables(self):
5959
)
6060
sys.exit()
6161

62-
def add_host(self, ip, hostname, domain, os, signing = None, cbt_status = None):
62+
def add_host(self, ip, hostname, domain, os, signing=None, cbt_status=None):
6363
"""Check if this host has already been added to the database, if not, add it in."""
6464
hosts = []
6565
updated_ids = []
@@ -74,8 +74,8 @@ def add_host(self, ip, hostname, domain, os, signing = None, cbt_status = None):
7474
"hostname": hostname,
7575
"domain": domain,
7676
"os": os,
77-
"signing" : signing,
78-
"cbt_status" : cbt_status
77+
"signing": signing,
78+
"cbt_status": cbt_status
7979
}
8080
hosts = [new_host]
8181
# update existing hosts data

nxc/protocols/ldap/db_navigator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def display_hosts(self, hosts):
2828
os = host[4]
2929

3030
signing = "Enforced" if bool(host[5]) else "None"
31-
cbt_status = host[6]
31+
cbt_status = host[6]
3232

3333
data.append(
3434
[
@@ -38,7 +38,7 @@ def display_hosts(self, hosts):
3838
domain,
3939
os,
4040
signing,
41-
cbt_status ]
41+
cbt_status]
4242
)
4343
print_table(data, title="Hosts")
4444

@@ -80,7 +80,7 @@ def do_hosts(self, line):
8080
os = host[4]
8181

8282
signing = "Enforced" if bool(host[5]) else "None"
83-
cbt_status = host[6]
83+
cbt_status = host[6]
8484

8585
data.append(
8686
[

0 commit comments

Comments
 (0)