MCPcopy Create free account
hub / github.com/Synzack/ldapper / convertSID

Function convertSID

SecurityDescriptor/SecurityDescriptorFuncs.go:142–165  ·  view source on GitHub ↗
(hexSID string)

Source from the content-addressed store, hash-verified

140}
141
142func convertSID(hexSID string) (SID string) {
143 //https://devblogs.microsoft.com/oldnewthing/20040315-00/?p=40253
144 var fields []string
145 fields = append(fields, hexSID[0:2])
146 if fields[0] == "01" {
147 fields[0] = "S-1"
148 }
149 numDashes, _ := strconv.Atoi(hexToDecimalString(hexSID[2:4]))
150
151 fields = append(fields, "-"+hexToDecimalString(hexSID[4:16]))
152
153 lower, upper := 16, 24
154 for i := 1; i <= numDashes; i++ {
155 fields = append(fields, "-"+hexToDecimalString(endianConvert(hexSID[lower:upper])))
156 lower += 8
157 upper += 8
158 }
159
160 for i := 0; i < len(fields); i++ {
161 SID += (fields[i])
162 }
163
164 return
165}
166
167func getDACL(header *HEADER, sd string) (DACL string) {
168 offset := hexToOffset(header.OffsetDacl)

Callers 4

getOwnerFunction · 0.85
GetGroupFunction · 0.85
parseMethod · 0.85
parseMethod · 0.85

Calls 2

hexToDecimalStringFunction · 0.85
endianConvertFunction · 0.85

Tested by

no test coverage detected