@@ -1091,7 +1091,7 @@ def find_delegation(self):
10911091 UF_TRUSTED_FOR_DELEGATION = 0x80000
10921092 UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x1000000
10931093 UF_ACCOUNTDISABLE = 0x2
1094- SERVER_TRUST_ACCOUNT = 0x2000
1094+ UF_SERVER_TRUST_ACCOUNT = 0x2000
10951095
10961096 def printTable (items , header ):
10971097 colLen = []
@@ -1124,12 +1124,12 @@ def printTable(items, header):
11241124 f"(UserAccountControl:1.2.840.113556.1.4.803:={ UF_TRUSTED_FOR_DELEGATION } )"
11251125 "(msDS-AllowedToDelegateTo=*)(msDS-AllowedToActOnBehalfOfOtherIdentity=*))"
11261126 f"(!(UserAccountControl:1.2.840.113556.1.4.803:={ UF_ACCOUNTDISABLE } )))" )
1127- # f"(!(UserAccountControl:1.2.840.113556.1.4.803:={SERVER_TRUST_ACCOUNT })))") This would filter out RBCD to DCs
1127+ # f"(!(UserAccountControl:1.2.840.113556.1.4.803:={UF_SERVER_TRUST_ACCOUNT })))") This would filter out RBCD to DCs
11281128
11291129 attributes = ["sAMAccountName" , "pwdLastSet" , "userAccountControl" , "objectCategory" ,
11301130 "msDS-AllowedToActOnBehalfOfOtherIdentity" , "msDS-AllowedToDelegateTo" ]
11311131
1132- resp = self .search (search_filter , attributes , 0 )
1132+ resp = self .search (search_filter , attributes )
11331133 answers = []
11341134 self .logger .debug (f"Total of records returned { len (resp ):d} " )
11351135 resp_parse = parse_result_attributes (resp )
@@ -1149,7 +1149,7 @@ def printTable(items, header):
11491149 objectType = item .get ("objectCategory" )
11501150
11511151 # Filter out DCs, unconstrained delegation to DCs is not a useful information
1152- if userAccountControl & UF_TRUSTED_FOR_DELEGATION and not userAccountControl & SERVER_TRUST_ACCOUNT :
1152+ if userAccountControl & UF_TRUSTED_FOR_DELEGATION and not userAccountControl & UF_SERVER_TRUST_ACCOUNT :
11531153 delegation = "Unconstrained"
11541154 rightsTo .append ("N/A" )
11551155 elif userAccountControl & UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION :
@@ -1171,8 +1171,8 @@ def printTable(items, header):
11711171 search_filter = "(&(|"
11721172 for ace in sd ["Dacl" ].aces :
11731173 search_filter += "(objectSid=" + ace ["Ace" ]["Sid" ].formatCanonical () + ")"
1174- search_filter += ")(!(UserAccountControl:1.2.840.113556.1.4.803:=2 )))"
1175- delegUserResp = self .search (search_filter , attributes = ["sAMAccountName" , "objectCategory" ], sizeLimit = 999 )
1174+ search_filter += f ")(!(UserAccountControl:1.2.840.113556.1.4.803:={ UF_ACCOUNTDISABLE } )))"
1175+ delegUserResp = self .search (search_filter , attributes = ["sAMAccountName" , "objectCategory" ])
11761176 delegUserResp_parse = parse_result_attributes (delegUserResp )
11771177
11781178 for rbcd in delegUserResp_parse :
0 commit comments