securitydescriptor

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 20 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NtSecurityDescriptor

type NtSecurityDescriptor struct {
	Header header.NtSecurityDescriptorHeader

	Owner *identity.Identity
	Group *identity.Identity

	DACL *acl.DiscretionaryAccessControlList
	SACL *acl.SystemAccessControlList

	// Internal
	RawBytes     []byte
	RawBytesSize uint32
}

NtSecurityDescriptor represents a Windows security descriptor.

func NewSecurityDescriptor

func NewSecurityDescriptor() *NtSecurityDescriptor

NewSecurityDescriptor creates a new NtSecurityDescriptor with initialized fields.

Returns:

  • *NtSecurityDescriptor: A pointer to the newly created security descriptor.

func (*NtSecurityDescriptor) Describe

func (ntsd *NtSecurityDescriptor) Describe(indent int)

Describe prints the NtSecurityDescriptor in a human-readable format.

Parameters:

  • indent (int): The indentation level for the output.

func (*NtSecurityDescriptor) Equal

func (ntsd *NtSecurityDescriptor) Equal(other *NtSecurityDescriptor) bool

Equal compares two NtSecurityDescriptor instances for equality.

Parameters:

  • other (*NtSecurityDescriptor): The NtSecurityDescriptor to compare with.

Returns:

  • bool: True if the NtSecurityDescriptors are equal, false otherwise.

func (*NtSecurityDescriptor) FindIdentitiesWithAllExtendedRights

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithAllExtendedRights(extendedRightsGUIDs []string) map[*sid.SID][]string

FindIdentitiesWithAllExtendedRights finds identities that have all of the specified extended rights.

Parameters:

  • extendedRightsGUIDs ([]string): The GUIDs of the extended rights to search for.

Returns:

  • map[*identity.SID][]string: A map of identities to their matching extended rights.

func (*NtSecurityDescriptor) FindIdentitiesWithAllRights

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithAllRights(accessMaskRights []uint32) map[*sid.SID][]uint32

FindIdentitiesWithAllRights finds identities that have all of the specified access mask rights.

Parameters:

  • accessMaskRights ([]uint32): The access mask rights to search for.

Returns:

  • map[*identity.SID][]uint32: A map of identities to their matching access mask rights.

func (*NtSecurityDescriptor) FindIdentitiesWithAnyExtendedRight

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithAnyExtendedRight(extendedRightsGUIDs []string) map[*sid.SID][]string

FindIdentitiesWithAnyExtendedRight finds identities that have any of the specified extended rights.

Parameters:

  • extendedRightsGUIDs ([]string): The GUIDs of the extended rights to search for.

Returns:

  • map[*identity.SID][]string: A map of identities to their matching extended rights.

func (*NtSecurityDescriptor) FindIdentitiesWithAnyRight

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithAnyRight(accessMaskRights []uint32) map[*sid.SID][]uint32

FindIdentitiesWithAnyRight finds identities that have any of the specified access mask rights.

Parameters:

  • accessMaskRights ([]uint32): The access mask rights to search for.

Returns:

  • map[*identity.SID][]uint32: A map of identities to their matching access mask rights.

func (*NtSecurityDescriptor) FindIdentitiesWithExtendedRight

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithExtendedRight(extendedRightGUID string) map[*sid.SID][]string

FindIdentitiesWithExtendedRight finds identities that have a specific extended right.

Parameters:

  • extendedRightGUID (string): The GUID of the extended right to search for.

Returns:

  • map[*identity.SID][]string: A map of identities to their matching extended rights.

func (*NtSecurityDescriptor) FindIdentitiesWithRight

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithRight(accessMaskRightValue uint32) map[*sid.SID][]uint32

FindIdentitiesWithRight finds identities that have a specific access mask right.

Parameters:

  • accessMaskRightValue (uint32): The access mask right value to search for.

Returns:

  • map[*identity.SID][]uint32: A map of identities to their matching access mask rights.

func (*NtSecurityDescriptor) FindIdentitiesWithUnexpectedExtendedRights

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithUnexpectedExtendedRights(expectedExtendedRightsToIdentitiesMap map[string][]string) map[string][]*sid.SID

FindIdentitiesWithUnexpectedExtendedRights finds identities that have unexpected extended rights.

Parameters:

  • expectedExtendedRightsToIdentitiesMap (map[string][]string): A map of expected extended rights to their corresponding identities.

Returns:

  • map[string][]*identity.SID: A map of unexpected extended rights to their corresponding identities.

func (*NtSecurityDescriptor) FindIdentitiesWithUnexpectedRights

func (ntsd *NtSecurityDescriptor) FindIdentitiesWithUnexpectedRights(expectedRightsToIdentitiesMap map[uint32][]string) map[uint32][]*sid.SID

FindIdentitiesWithUnexpectedRights finds identities that have unexpected access mask rights.

Parameters:

  • expectedRightsToIdentitiesMap (map[uint32][]string): A map of expected access mask rights to their corresponding identities.

Returns:

  • map[uint32][]*identity.SID: A map of unexpected access mask rights to their corresponding identities.

func (*NtSecurityDescriptor) FromSDDLString

func (ntsd *NtSecurityDescriptor) FromSDDLString(sddlString string) (int, error)

FromSDDLString initializes the NtSecurityDescriptor struct by parsing the SDDL string.

Parameters:

  • sddlString (string): The SDDL string to be parsed.

Returns:

  • (int, error): Always returns 0 for the int value, and an error if parsing fails.

func (*NtSecurityDescriptor) GetDacl

GetDacl returns the DACL field of the NtSecurityDescriptor.

Returns:

  • acl.DiscretionaryAccessControlList: The DACL field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) GetGroup

func (ntsd *NtSecurityDescriptor) GetGroup() *identity.Identity

GetGroup returns the Group field of the NtSecurityDescriptor.

Returns:

  • identity.Identity: The Group field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) GetOwner

func (ntsd *NtSecurityDescriptor) GetOwner() *identity.Identity

GetOwner returns the Owner field of the NtSecurityDescriptor.

Returns:

  • identity.Identity: The Owner field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) GetSacl

GetSacl returns the SACL field of the NtSecurityDescriptor.

Returns:

  • acl.SystemAccessControlList: The SACL field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) Marshal

func (ntsd *NtSecurityDescriptor) Marshal() ([]byte, error)

Marshal serializes the NtSecurityDescriptor struct into a byte slice.

Returns:

  • ([]byte, error): A byte slice containing the serialized data and an error if serialization fails, otherwise nil.

func (*NtSecurityDescriptor) SetDacl

SetDacl sets the DACL field of the NtSecurityDescriptor.

Parameters:

  • dacl (acl.DiscretionaryAccessControlList): The new DACL field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) SetGroup

func (ntsd *NtSecurityDescriptor) SetGroup(group *identity.Identity)

SetGroup sets the Group field of the NtSecurityDescriptor.

Parameters:

  • group (identity.Identity): The new Group field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) SetOwner

func (ntsd *NtSecurityDescriptor) SetOwner(owner *identity.Identity)

SetOwner sets the Owner field of the NtSecurityDescriptor.

Parameters:

  • owner (identity.Identity): The new Owner field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) SetSacl

func (ntsd *NtSecurityDescriptor) SetSacl(sacl *acl.SystemAccessControlList)

SetSacl sets the SACL field of the NtSecurityDescriptor.

Parameters:

  • sacl (acl.SystemAccessControlList): The new SACL field of the NtSecurityDescriptor.

func (*NtSecurityDescriptor) ToSDDLString

func (ntsd *NtSecurityDescriptor) ToSDDLString() (string, error)

ToSDDLString converts the NtSecurityDescriptor to an SDDL string representation.

Returns:

  • (string, error): The SDDL string representation and any error that occurred.

func (*NtSecurityDescriptor) Unmarshal

func (ntsd *NtSecurityDescriptor) Unmarshal(marshalledData []byte) (int, error)

Unmarshal initializes the NtSecurityDescriptor struct by parsing the raw byte array.

Parameters:

  • rawBytes ([]byte): The raw byte array to be parsed.

Returns:

  • error: An error if parsing fails, otherwise nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL