From ee23c7bdf5bd0559c59c9b4f8a0d278217692644 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Thu, 25 Mar 2021 06:03:37 +0700 Subject: [PATCH 1/2] :hammer: Fix exclude threats logic to set datasets --- pkg/teler/teler.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/teler/teler.go b/pkg/teler/teler.go index 1805a332..07f80ea2 100644 --- a/pkg/teler/teler.go +++ b/pkg/teler/teler.go @@ -34,14 +34,13 @@ func Analyze(options *common.Options, logs *gonx.Entry) (bool, map[string]string threat := reflect.ValueOf(&rsc.Threat[i]).Elem() cat := threat.FieldByName("Category").String() con := threat.FieldByName("Content").String() - exc := threat.FieldByName("Exclude").Bool() - datasets[cat] = map[string]string{} - datasets[cat]["content"] = con - - if exc { + if threat.FieldByName("Exclude").Bool() { continue } + + datasets[cat] = map[string]string{} + datasets[cat]["content"] = con } } From 1cc5652d7e6e819f9274c45ebe0ad0637dac867f Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Thu, 25 Mar 2021 06:04:26 +0700 Subject: [PATCH 2/2] :rotating_light: Fix gosimple linter --- pkg/matchers/fuzz.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/matchers/fuzz.go b/pkg/matchers/fuzz.go index 527a2caa..b4038365 100644 --- a/pkg/matchers/fuzz.go +++ b/pkg/matchers/fuzz.go @@ -4,9 +4,6 @@ import "github.com/sahilm/fuzzy" func IsMatchFuzz(pattern string, s []string) bool { matches := fuzzy.Find(pattern, s) - if len(matches) > 0 { - return true - } - return false + return len(matches) > 0 }