From 4ab500c0493b666eee0768a70f18420ddef6eae5 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Wed, 4 Jan 2023 11:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80crawl=E4=B8=8Eextract?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/baseline.go | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/pkg/baseline.go b/pkg/baseline.go index e296deb..1f752b2 100644 --- a/pkg/baseline.go +++ b/pkg/baseline.go @@ -3,6 +3,7 @@ package pkg import ( "bytes" "encoding/json" + "github.com/chainreactors/gogo/v2/pkg/fingers" "github.com/chainreactors/gogo/v2/pkg/utils" "github.com/chainreactors/logs" "github.com/chainreactors/parsers" @@ -84,7 +85,7 @@ type Baseline struct { Reason string `json:"reason"` IsValid bool `json:"valid"` IsFuzzy bool `json:"fuzzy"` - URLs []string `json:"urls"` + URLs []string `json:"-"` Source int `json:"source"` RecuDepth int `json:"-"` ReqDepth int `json:"depth"` @@ -130,6 +131,12 @@ func (bl *Baseline) CollectURL() { } } } + if bl.URLs != nil { + bl.Extracteds = append(bl.Extracteds, &fingers.Extracted{ + Name: "crawl", + ExtractResult: bl.URLs, + }) + } } // Compare @@ -295,15 +302,9 @@ func (bl *Baseline) ColorString() string { line.WriteString(logs.CyanLine(bl.RedirectURL)) line.WriteString(" ") } - if len(bl.URLs) > 0 { - line.WriteString("\n crawl: \n") - } - for _, u := range bl.URLs { - line.WriteString("\t" + logs.GreenLine(u) + "\n") - } if len(bl.Extracteds) > 0 { for _, e := range bl.Extracteds { - line.WriteString(" " + e.Name + ": \n\t") + line.WriteString("\n " + e.Name + ": \n\t") line.WriteString(logs.GreenLine(strings.Join(e.ExtractResult, "\n\t"))) } } @@ -348,15 +349,9 @@ func (bl *Baseline) String() string { line.WriteString(bl.RedirectURL) line.WriteString(" ") } - if len(bl.URLs) > 0 { - line.WriteString("\n crawl: \n") - } - for _, u := range bl.URLs { - line.WriteString("\t" + u + "\n") - } if len(bl.Extracteds) > 0 { for _, e := range bl.Extracteds { - line.WriteString(" " + e.Name + ": \n\t") + line.WriteString("\n " + e.Name + ": \n\t") line.WriteString(strings.Join(e.ExtractResult, "\n\t")) } }