Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into missing-mhe-check-payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsandeep committed Apr 24, 2024
2 parents 0387a98 + cfe6f5d commit 4d615af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestUnmarshal(t *testing.T) {
templateName := "Test Template"
authors := []string{"forgedhallpass", "ice3man"}
tags := []string{"cve", "misc"}
references := []string{"http://test.com", "http://domain.com"}
references := []string{"http://test.com", "http://Domain.com"}

dynamicKey1 := "customDynamicKey1"
dynamicKey2 := "customDynamicKey2"
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestUnmarshal(t *testing.T) {
author: ` + strings.Join(authors, ", ") + `
tags: ` + strings.Join(tags, ", ") + `
severity: critical
reference: ` + strings.Join(references, ", ") + `
reference: ` + strings.Join(references, ",") + `
metadata:
` + dynamicKey1 + `: ` + dynamicKeysMap[dynamicKey1].(string) + `
` + dynamicKey2 + `: ` + dynamicKeysMap[dynamicKey2].(string) + `
Expand Down
9 changes: 9 additions & 0 deletions pkg/model/types/stringslice/stringslice_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ func (rawStringSlice *RawStringSlice) Normalize(value string) string {
return value
}

func (rawStringSlice *RawStringSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
marshalledSlice, err := marshalStringToSlice(unmarshal)
if err != nil {
return err
}
rawStringSlice.Value = marshalledSlice
return nil
}

func (rawStringSlice RawStringSlice) JSONSchemaAlias() any {
return StringOrSlice("")
}
6 changes: 3 additions & 3 deletions pkg/protocols/dns/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestDNSExecuteWithResults(t *testing.T) {
Name: "test",
Part: "raw",
Type: matchers.MatcherTypeHolder{MatcherType: matchers.WordsMatcher},
Words: []string{"93.184.216.34"},
Words: []string{"93.184.215.14"},
}},
Extractors: []*extractors.Extractor{{
Part: "raw",
Expand All @@ -64,7 +64,7 @@ func TestDNSExecuteWithResults(t *testing.T) {
require.Equal(t, 1, len(finalEvent.Results), "could not get correct number of results")
require.Equal(t, "test", finalEvent.Results[0].MatcherName, "could not get correct matcher name of results")
require.Equal(t, 1, len(finalEvent.Results[0].ExtractedResults), "could not get correct number of extracted results")
require.Equal(t, "93.184.216.34", finalEvent.Results[0].ExtractedResults[0], "could not get correct extracted results")
require.Equal(t, "93.184.215.14", finalEvent.Results[0].ExtractedResults[0], "could not get correct extracted results")
finalEvent = nil

t.Run("url-to-domain", func(t *testing.T) {
Expand All @@ -79,6 +79,6 @@ func TestDNSExecuteWithResults(t *testing.T) {
require.Equal(t, 1, len(finalEvent.Results), "could not get correct number of results")
require.Equal(t, "test", finalEvent.Results[0].MatcherName, "could not get correct matcher name of results")
require.Equal(t, 1, len(finalEvent.Results[0].ExtractedResults), "could not get correct number of extracted results")
require.Equal(t, "93.184.216.34", finalEvent.Results[0].ExtractedResults[0], "could not get correct extracted results")
require.Equal(t, "93.184.215.14", finalEvent.Results[0].ExtractedResults[0], "could not get correct extracted results")
finalEvent = nil
}

0 comments on commit 4d615af

Please sign in to comment.