Added normalized wappalyzer versioned appName

dev
Ice3man 2022-05-09 11:02:21 +05:30
parent 7e11232952
commit d7d80e3447
2 changed files with 25 additions and 1 deletions

View File

@ -171,7 +171,7 @@ func (s *Service) processWappalyzerInputPair(input string) {
fingerprints := s.wappalyzer.Fingerprint(resp.Header, data) fingerprints := s.wappalyzer.Fingerprint(resp.Header, data)
normalized := make(map[string]struct{}) normalized := make(map[string]struct{})
for k := range fingerprints { for k := range fingerprints {
normalized[strings.ToLower(k)] = struct{}{} normalized[normalizeAppName(k)] = struct{}{}
} }
if s.opts.Options.Verbose { if s.opts.Options.Verbose {
@ -215,6 +215,15 @@ func (s *Service) processWappalyzerInputPair(input string) {
} }
} }
func normalizeAppName(appName string) string {
if strings.Contains(appName, ":") {
if parts := strings.Split(appName, ":"); len(parts) == 2 {
appName = parts[0]
}
}
return strings.ToLower(appName)
}
func uniqueSlice(slice []string) []string { func uniqueSlice(slice []string) []string {
data := make(map[string]struct{}, len(slice)) data := make(map[string]struct{}, len(slice))
for _, item := range slice { for _, item := range slice {

View File

@ -0,0 +1,15 @@
package automaticscan
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestNormalizeAppName(t *testing.T) {
appName := normalizeAppName("JBoss")
require.Equal(t, "jboss", appName, "could not get normalized name")
appName = normalizeAppName("JBoss:2.3.5")
require.Equal(t, "jboss", appName, "could not get normalized name")
}