@@ -815,6 +815,26 @@ def resolve_and_display_hostname(name, domain_name=None):
815815 trust_flat_name = trust ["flatName" ]
816816 trust_direction = int (trust ["trustDirection" ])
817817 trust_type = int (trust ["trustType" ])
818+ trust_attributes = trust ["trustAttributes" ]
819+
820+ trust_attribute_flags = {
821+ 0x1 : "Non-Transitive" ,
822+ 0x2 : "Uplevel-Only" ,
823+ 0x4 : "Quarantined Domain" ,
824+ 0x8 : "Forest Transitive" ,
825+ 0x10 : "Cross Organization" ,
826+ 0x20 : "Within Forest" ,
827+ 0x40 : "Treat as External" ,
828+ 0x80 : "Uses RC4 Encryption" ,
829+ 0x100 : "Cross Organization No TGT Delegation" ,
830+ 0x2000 : "PAM Trust"
831+ }
832+
833+ # For check if multiple posibble flags, like Uplevel-Only, Treat as External
834+ trust_attributes_text = ", " .join ([
835+ text for flag , text in trust_attribute_flags .items ()
836+ if int (trust_attributes ) & flag
837+ ]) or "Other" # If Trust attrs not known
818838
819839 # Convert trust direction/type to human-readable format
820840 direction_text = {
@@ -833,7 +853,7 @@ def resolve_and_display_hostname(name, domain_name=None):
833853 }[trust_type ]
834854
835855 self .logger .info (f"Processing trusted domain: { trust_name } ({ trust_flat_name } )" )
836- self .logger .info (f"Trust type: { trust_type_text } , Direction: { direction_text } " )
856+ self .logger .info (f"Trust type: { trust_type_text } , Direction: { direction_text } , Trust Attributes: { trust_attributes_text } " )
837857
838858 except Exception as e :
839859 self .logger .fail (f"Failed { e } in trust entry: { trust } " )
@@ -849,6 +869,7 @@ def resolve_and_display_hostname(name, domain_name=None):
849869 for srv in srv_records :
850870 dc_hostname = str (srv .target ).rstrip ("." )
851871 self .logger .highlight (f"Found DC in trusted domain: { colored (dc_hostname , host_info_colors [0 ])} " )
872+ self .logger .highlight (f"{ trust_name } -> { direction_text } -> { trust_attributes_text } " )
852873 resolve_and_display_hostname (dc_hostname )
853874 except Exception as e :
854875 self .logger .fail (f"Failed to resolve DCs for { trust_name } via DNS: { e } " )
0 commit comments