@@ -149,8 +149,8 @@ def __init__(self, args, db, host):
149149 self .output_filename = None
150150 self .smbv1 = None
151151 self .signing = False
152- self .signing_required = False
153- self .cbt_status = 0
152+ self .signing_required = None
153+ self .cbt_status = None
154154 self .admin_privs = False
155155 self .no_ntlm = False
156156 self .sid_domain = ""
@@ -235,6 +235,7 @@ def get_ldap_username(self):
235235 return ""
236236
237237 def check_ldap_signing (self ):
238+ self .signing_required = False
238239 ldap_url = f"ldap://{ self .target } "
239240 ldap_connection = ldap_impacket .LDAPConnection (url = ldap_url , baseDN = self .baseDN , dstIp = self .host , signing = False )
240241 try :
@@ -244,14 +245,15 @@ def check_ldap_signing(self):
244245 self .signing_required = True
245246
246247 def check_ldaps_cbt (self ):
248+ self .cbt_status = "Never"
247249 ldap_url = f"ldaps://{ self .target } "
248250 ldap_connection = ldap_impacket .LDAPConnection (url = ldap_url , baseDN = self .baseDN , dstIp = self .host )
249251 ldap_connection ._LDAPConnection__channel_binding_value = None
250252 try :
251253 ldap_connection .login (user = " " ,domain = self .domain )
252254 except ldap_impacket .LDAPSessionError as e :
253255 if str (e ).find ("data 80090346" ) >= 0 :
254- self .cbt_status = 2 # CBT is Required
256+ self .cbt_status = "Always" # CBT is Required
255257 elif str (e ).find ("data 52e" ) >= 0 :
256258 ldap_connection = ldap_impacket .LDAPConnection (url = ldap_url , baseDN = self .baseDN , dstIp = self .host )
257259 tmp = bytearray (ldap_connection ._LDAPConnection__channel_binding_value )
@@ -261,7 +263,7 @@ def check_ldaps_cbt(self):
261263 ldap_connection .login (user = " " ,domain = self .domain )
262264 except ldap_impacket .LDAPSessionError as e :
263265 if str (e ).find ("data 80090346" ) >= 0 :
264- self .cbt_status = 1 # CBT is When Supported
266+ self .cbt_status = "When Supported" # CBT is When Supported
265267
266268 def enum_host_info (self ):
267269 self .hostname = self .target .split ("." )[0 ].upper () if "." in self .target else self .target
@@ -309,15 +311,17 @@ def enum_host_info(self):
309311 self .host ,
310312 self .hostname ,
311313 self .domain ,
312- self .server_os
314+ self .server_os ,
315+ self .signing_required ,
316+ self .cbt_status
313317 )
314318 except Exception as e :
315319 self .logger .debug (f"Error adding host { self .host } into db: { e !s} " )
316320
317321 def print_host_info (self ):
318322 self .logger .debug ("Printing host info for LDAP" )
319323 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" ])
320- cbt_status = colored (f"channel binding:Always " , host_info_colors [0 ], attrs = ["bold" ]) if self .cbt_status == 2 else colored (f"channel binding:{ 'Never' if self .cbt_status == 0 else 'When Supported' } " , host_info_colors [1 ], attrs = ["bold" ])
324+ 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" ])
321325 ntlm = colored (f"(NTLM:{ not self .no_ntlm } )" , host_info_colors [2 ], attrs = ["bold" ]) if self .no_ntlm else ""
322326 self .logger .extra ["protocol" ] = "LDAP" if str (self .port ) == "389" else "LDAPS"
323327 self .logger .extra ["port" ] = self .port
0 commit comments