Skip to content

Commit

Permalink
Display all subauthorities for GUID in SRUM (Velocidex#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette authored Nov 3, 2021
1 parent 64866f6 commit eced6fc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
VERSION = "0.6.2-rc2"
VERSION = "0.6.3-dev"
ENROLLMENT_WELL_KNOWN_FLOW = "E:Enrol"
MONITORING_WELL_KNOWN_FLOW = FLOW_PREFIX + "Monitoring"

Expand Down
4 changes: 2 additions & 2 deletions vql/parsers/ese/ese.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (self _SRUMLookupId) Call(

// Its a GUID
if id_details.IdType == 3 {
id_details.IdBlob = formatGUI(id_details.IdBlob)
id_details.IdBlob = formatGUID(id_details.IdBlob)
} else {
id_details.IdBlob = formatString(id_details.IdBlob)
}
Expand Down Expand Up @@ -163,7 +163,7 @@ func formatString(hexencoded string) string {
return ParseTerminatedUTF16String(&utils.BufferReaderAt{Buffer: buffer}, 0)
}

func formatGUI(hexencoded string) string {
func formatGUID(hexencoded string) string {
if len(hexencoded) == 0 {
return hexencoded
}
Expand Down
4 changes: 2 additions & 2 deletions vql/parsers/ese/profile_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ func (self *SID) Authority2() uint32 {
}

func (self *SID) Subauthority() []uint32 {
return ParseArray_uint32(self.Profile, self.Reader, self.Profile.Off_SID_Subauthority + self.Offset, 2)
return ParseArray_uint32(self.Profile, self.Reader, self.Profile.Off_SID_Subauthority + self.Offset, 100)
}

func ParseArray_uint32(profile *MiscProfile, reader io.ReaderAt, offset int64, count int) []uint32 {
result := []uint32{}
result := make([]uint32, 0, count)
for i:=0; i<count; i++ {
value := ParseUint32(reader, offset)
result = append(result, value)
Expand Down
11 changes: 7 additions & 4 deletions vql/parsers/ese/sid.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ func (self *SID) String() string {
result := fmt.Sprintf("S-%d", uint64(bits.ReverseBytes16(self.Authority()))<<32+
uint64(bits.ReverseBytes32(self.Authority2())))

for _, sub := range self.Subauthority() {
if sub != 0 {
result += fmt.Sprintf("-%d", sub)
sub_authorities := self.Subauthority()
for i := 0; i < int(self.SubAuthCount()); i++ {
if i > len(sub_authorities) {
break
}
}

sub := sub_authorities[i]
result += fmt.Sprintf("-%d", sub)
}
return result
}
2 changes: 1 addition & 1 deletion vql/parsers/ese/vtype_profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Authority2": [4, ["unsigned long"]],
"Subauthority": [8, ["Array", {
"target": "unsigned long",
"count": 2
"count": 100
}]]
}],

Expand Down

0 comments on commit eced6fc

Please sign in to comment.