From 6f8cd0173629889b001c833953591dff5bda127e Mon Sep 17 00:00:00 2001 From: M09Ic Date: Tue, 20 Feb 2024 21:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA,=20=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E8=A6=81=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/runner.go | 8 ++++---- pkg/statistor.go | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/runner.go b/internal/runner.go index 682e5e4..31261f7 100644 --- a/internal/runner.go +++ b/internal/runner.go @@ -340,14 +340,14 @@ func (r *Runner) PrintStat(pool *pool.BrutePool) { if r.Color { logs.Log.Important(pool.Statistor.ColorString()) if pool.Statistor.Error == "" { - pool.Statistor.PrintColorCount() - pool.Statistor.PrintColorSource() + logs.Log.Log(pkg.LogVerbose, pool.Statistor.ColorCountString()) + logs.Log.Log(pkg.LogVerbose, pool.Statistor.ColorSourceString()) } } else { logs.Log.Important(pool.Statistor.String()) if pool.Statistor.Error == "" { - pool.Statistor.PrintCount() - pool.Statistor.PrintSource() + logs.Log.Log(pkg.LogVerbose, pool.Statistor.CountString()) + logs.Log.Log(pkg.LogVerbose, pool.Statistor.SourceString()) } } diff --git a/pkg/statistor.go b/pkg/statistor.go index 7f01569..a57aac4 100644 --- a/pkg/statistor.go +++ b/pkg/statistor.go @@ -111,9 +111,9 @@ func (stat *Statistor) String() string { return s.String() } -func (stat *Statistor) PrintCount() { +func (stat *Statistor) CountString() string { if len(stat.Counts) == 0 { - return + return "" } var s strings.Builder s.WriteString("[stat] ") @@ -124,12 +124,12 @@ func (stat *Statistor) PrintCount() { } s.WriteString(fmt.Sprintf(" %d: %d,", k, v)) } - logs.Log.Important(s.String()) + return s.String() } -func (stat *Statistor) PrintSource() { +func (stat *Statistor) SourceString() string { if len(stat.Sources) == 0 { - return + return "" } var s strings.Builder s.WriteString("[stat] ") @@ -137,12 +137,12 @@ func (stat *Statistor) PrintSource() { for k, v := range stat.Sources { s.WriteString(fmt.Sprintf(" %s: %d,", k.Name(), v)) } - logs.Log.Important(s.String()) + return s.String() } -func (stat *Statistor) PrintColorCount() { +func (stat *Statistor) ColorCountString() string { if len(stat.Counts) == 0 { - return + return "" } var s strings.Builder s.WriteString(fmt.Sprintf("[stat] %s ", stat.BaseUrl)) @@ -152,19 +152,19 @@ func (stat *Statistor) PrintColorCount() { } s.WriteString(fmt.Sprintf(" %s: %s,", logs.Cyan(strconv.Itoa(k)), logs.YellowBold(strconv.Itoa(v)))) } - logs.Log.Important(s.String()) + return s.String() } -func (stat *Statistor) PrintColorSource() { +func (stat *Statistor) ColorSourceString() string { if len(stat.Sources) == 0 { - return + return "" } var s strings.Builder s.WriteString(fmt.Sprintf("[stat] %s ", stat.BaseUrl)) for k, v := range stat.Sources { s.WriteString(fmt.Sprintf(" %s: %s,", logs.Cyan(k.Name()), logs.YellowBold(strconv.Itoa(v)))) } - logs.Log.Important(s.String()) + return s.String() } func (stat *Statistor) Json() string {