# Impacket - Collection of Python classes for working with network protocols. # # Copyright Fortra, LLC and its affiliated companies # # All rights reserved. # # This software is provided under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Description: # Structures and types used in LDAP # Contains the Structures for the NT Security Descriptor (non-RPC format) and # all ACL related structures # # Author: # Dirk-jan Mollema (@_dirkjan) / Fox-IT (https://www.fox-it.com) # from struct import unpack, pack from impacket.structure import Structure from enum import Enum # Global constant if the library should recalculate ACE sizes in objects that are decoded/re-encoded. # This defaults to True, but this causes the ACLs to not match on a binary level # since Active Directory for some reason sometimes adds null bytes to the end of ACEs. # This is valid according to the spec (see 2.4.4), but since impacket encodes them more efficiently # this should be turned off if running unit tests. RECALC_ACE_SIZE = True # LDAP SID structure - based on SAMR_RPC_SID, except the SubAuthority is LE here class LDAP_SID_IDENTIFIER_AUTHORITY(Structure): structure = ( ('Value','6s'), ) class LDAP_SID(Structure): structure = ( ('Revision','