From 3e63812ab0d689b0e794eeee5ffaffe6e125c309 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Sat, 29 Jun 2024 03:56:44 +0800 Subject: [PATCH] adapt all finger engine --- pkg/baseline.go | 6 +++--- pkg/fingers.go | 10 ++-------- templates | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pkg/baseline.go b/pkg/baseline.go index 18925ad..4718f18 100644 --- a/pkg/baseline.go +++ b/pkg/baseline.go @@ -137,10 +137,10 @@ func (bl *Baseline) IsDir() bool { func (bl *Baseline) Collect() { if bl.ContentType == "html" || bl.ContentType == "json" || bl.ContentType == "txt" { // 指纹库设计的时候没考虑js,css文件的指纹, 跳过非必要的指纹收集减少误报提高性能 - bl.Frameworks = FingersDetect(bl.Raw) if EnableAllFingerEngine { - bl.Frameworks.Merge(FingerPrintHubDetect(bl.Response.Header, string(bl.Body))) - bl.Frameworks.Merge(WappalyzerDetect(bl.Response.Header, bl.Body)) + bl.Frameworks = EngineDetect(bl.Raw) + } else { + bl.Frameworks = FingersDetect(bl.Raw) } } diff --git a/pkg/fingers.go b/pkg/fingers.go index a8509ac..9c298b2 100644 --- a/pkg/fingers.go +++ b/pkg/fingers.go @@ -3,7 +3,6 @@ package pkg import ( "bytes" "github.com/chainreactors/fingers/common" - "net/http" ) // gogo fingers engine @@ -12,12 +11,7 @@ func FingersDetect(content []byte) common.Frameworks { return frames } -func FingerPrintHubDetect(header http.Header, body string) common.Frameworks { - frames := FingerEngine.FingerPrintEngine.Match(header, body) - return frames -} - -func WappalyzerDetect(header http.Header, body []byte) common.Frameworks { - frames := FingerEngine.WappalyzerEngine.Fingerprint(header, body) +func EngineDetect(content []byte) common.Frameworks { + frames, _ := FingerEngine.DetectContent(content) return frames } diff --git a/templates b/templates index d4db8ff..f1150d0 160000 --- a/templates +++ b/templates @@ -1 +1 @@ -Subproject commit d4db8ffbae6f0d52b18fea2bcabe7b2c29c2153d +Subproject commit f1150d00253e0c888976dbfe55cf2669c51f0b58