-
Notifications
You must be signed in to change notification settings - Fork 31
pkg security
Jacob Paullus edited this page Apr 17, 2026
·
1 revision
Parse, manipulate, and serialize Windows security descriptors, access control lists, and security identifiers.
| Function | Signature | Description |
|---|---|---|
ParseSID |
(s string) (*SID, error) |
Parse string SID (S-1-5-21-...) |
ParseSIDBytes |
(data []byte) (*SID, int, error) |
Parse binary SID |
| Method | Signature | Description |
|---|---|---|
String |
() string |
Format as S-1-5-21-...
|
Marshal |
() []byte |
Serialize to binary |
Size |
() int |
Binary size in bytes |
Equal |
(other *SID) bool |
Compare two SIDs |
func ParseSecurityDescriptor(data []byte) (*SecurityDescriptor, error)
func (sd *SecurityDescriptor) Marshal() []bytesdBytes := []byte{...} // from LDAP nTSecurityDescriptor attribute
sd, err := security.ParseSecurityDescriptor(sdBytes)
if err != nil {
fmt.Printf("[-] %v\n", err)
return
}
fmt.Printf("Owner: %s\n", sd.Owner.String())
if sd.DACL != nil {
for _, ace := range sd.DACL.ACEs {
fmt.Printf(" ACE: Type=%d, SID=%s, Mask=0x%08x\n",
ace.Type, ace.SID.String(), ace.AccessMask)
}
}