diff --git a/go.mod b/go.mod index 90e190e..2793477 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/chainreactors/spray go 1.21 -toolchain go1.21.3 - require github.com/chainreactors/go-metrics v0.0.0-20220926021830-24787b7a10f8 require ( @@ -13,7 +11,7 @@ require ( github.com/chainreactors/logs v0.0.0-20240207121836-c946f072f81f github.com/chainreactors/parsers v0.0.0-20240220101211-fc5d6e07ba81 github.com/chainreactors/utils v0.0.0-20231031063336-9477f1b23886 - github.com/chainreactors/words v0.4.1-0.20240208114042-a1c5053345b0 + github.com/chainreactors/words v0.4.1-0.20240220104223-153f52e53f37 github.com/goccy/go-yaml v1.11.2 github.com/gookit/config/v2 v2.2.5 github.com/gosuri/uiprogress v0.0.1 diff --git a/internal/option.go b/internal/option.go index 393152a..cbd12aa 100644 --- a/internal/option.go +++ b/internal/option.go @@ -25,6 +25,7 @@ import ( var ( DefaultThreads = 20 + SkipChar = "%SKIP%" ) type Option struct { diff --git a/internal/pool/brutepool.go b/internal/pool/brutepool.go index dcde456..bde820d 100644 --- a/internal/pool/brutepool.go +++ b/internal/pool/brutepool.go @@ -235,6 +235,11 @@ Loop: continue } pool.Statistor.End++ + if w == "" { + pool.Statistor.Skipped++ + continue + } + pool.wordOffset++ if pool.wordOffset < offset { continue diff --git a/pkg/statistor.go b/pkg/statistor.go index fa5ad9e..7f01569 100644 --- a/pkg/statistor.go +++ b/pkg/statistor.go @@ -50,6 +50,7 @@ type Statistor struct { FuzzyNumber int `json:"fuzzy"` WafedNumber int `json:"wafed"` End int `json:"end"` + Skipped int `json:"skipped"` Offset int `json:"offset"` Total int `json:"total"` StartTime int64 `json:"start_time"` @@ -63,7 +64,16 @@ type Statistor struct { func (stat *Statistor) ColorString() string { var s strings.Builder - s.WriteString(fmt.Sprintf("[stat] %s took %d s, request total: %s, finish: %s/%s, found: %s, check: %s, failed: %s", logs.GreenLine(stat.BaseUrl), stat.EndTime-stat.StartTime, logs.YellowBold(strconv.Itoa(int(stat.ReqTotal))), logs.YellowBold(strconv.Itoa(stat.End)), logs.YellowBold(strconv.Itoa(stat.Total)), logs.YellowBold(strconv.Itoa(stat.FoundNumber)), logs.YellowBold(strconv.Itoa(stat.CheckNumber)), logs.YellowBold(strconv.Itoa(int(stat.FailedNumber))))) + s.WriteString(fmt.Sprintf("[stat] %s took %d s, request total: %s, finish: %s/%s(%s skipped), found: %s, check: %s, failed: %s", + logs.GreenLine(stat.BaseUrl), + stat.EndTime-stat.StartTime, + logs.YellowBold(strconv.Itoa(int(stat.ReqTotal))), + logs.YellowBold(strconv.Itoa(stat.End)), + logs.YellowBold(strconv.Itoa(stat.Total)), + logs.YellowLine(strconv.Itoa(stat.Skipped)), + logs.YellowBold(strconv.Itoa(stat.FoundNumber)), + logs.YellowBold(strconv.Itoa(stat.CheckNumber)), + logs.YellowBold(strconv.Itoa(int(stat.FailedNumber))))) if stat.FuzzyNumber != 0 { s.WriteString(", fuzzy: " + logs.Yellow(strconv.Itoa(stat.FuzzyNumber))) @@ -78,7 +88,16 @@ func (stat *Statistor) ColorString() string { } func (stat *Statistor) String() string { var s strings.Builder - s.WriteString(fmt.Sprintf("[stat] %s took %d s, request total: %d, finish: %d/%d, found: %d, check: %d, failed: %d", stat.BaseUrl, stat.EndTime-stat.StartTime, stat.ReqTotal, stat.End, stat.Total, stat.FoundNumber, stat.CheckNumber, stat.FailedNumber)) + s.WriteString(fmt.Sprintf("[stat] %s took %d s, request total: %d, finish: %d/%d(%d skipped), found: %d, check: %d, failed: %d", + stat.BaseUrl, + stat.EndTime-stat.StartTime, + stat.ReqTotal, + stat.End, + stat.Total, + stat.Skipped, + stat.FoundNumber, + stat.CheckNumber, + stat.FailedNumber)) if stat.FuzzyNumber != 0 { s.WriteString(", fuzzy: " + strconv.Itoa(stat.FuzzyNumber)) @@ -126,8 +145,7 @@ func (stat *Statistor) PrintColorCount() { return } var s strings.Builder - s.WriteString("[stat] ") - s.WriteString(stat.BaseUrl) + s.WriteString(fmt.Sprintf("[stat] %s ", stat.BaseUrl)) for k, v := range stat.Counts { if k == 0 { continue @@ -142,8 +160,7 @@ func (stat *Statistor) PrintColorSource() { return } var s strings.Builder - s.WriteString("[stat] ") - s.WriteString(stat.BaseUrl) + 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)))) }