From 900dca32cb20ad0000f36ea65a2f9d361a3da45c Mon Sep 17 00:00:00 2001 From: M09Ic Date: Tue, 3 Jan 2023 17:30:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E--max-length=E5=8F=82?= =?UTF-8?q?=E6=95=B0,=20=E5=85=81=E8=AE=B8=E6=89=8B=E5=8A=A8=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=9C=80=E5=A4=A7=E8=AF=BB=E5=8F=96=E7=9A=84body?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/option.go | 7 ++++--- pkg/baseline.go | 4 ++-- pkg/ihttp/client.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/option.go b/internal/option.go index 3da4515..e96dc32 100644 --- a/internal/option.go +++ b/internal/option.go @@ -8,6 +8,7 @@ import ( "github.com/chainreactors/gogo/v2/pkg/fingers" "github.com/chainreactors/logs" "github.com/chainreactors/spray/pkg" + "github.com/chainreactors/spray/pkg/ihttp" "github.com/chainreactors/words/mask" "github.com/chainreactors/words/rule" "github.com/gosuri/uiprogress" @@ -71,6 +72,7 @@ type RequestOptions struct { //RandomUserAgent bool `long:"random-agent" description:"Bool, use random with default user-agent"` //Method string `long:"method" default:"GET" description:"String, custom method"` //Cookie string `long:"cookie" description:"String, custom cookie"` + MaxBodyLength int `long:"max-length" default:"100" description:"Int, max response body length, default 100k, e.g. -max-length 1000"` } type ModeOptions struct { @@ -168,9 +170,8 @@ func (opt *Option) PrepareRunner() (*Runner, error) { r.Progress.Start() logs.Log.Writer = r.Progress.Bypass() } - if opt.SimhashDistance != 0 { - pkg.Distance = uint8(opt.SimhashDistance) - } + pkg.Distance = uint8(opt.SimhashDistance) + ihttp.DefaultMaxBodySize = opt.MaxBodyLength * 1024 if opt.Force { // 如果开启了force模式, 将关闭check机制, err积累到一定数量自动退出机制 diff --git a/pkg/baseline.go b/pkg/baseline.go index fc51ce4..4882f12 100644 --- a/pkg/baseline.go +++ b/pkg/baseline.go @@ -323,8 +323,8 @@ func (bl *Baseline) ColorString() string { line.WriteString(" - ") line.WriteString(logs.YellowBold(strconv.Itoa(int(bl.Spended)) + "ms")) line.WriteString(logs.GreenLine(bl.Additional("title"))) - line.WriteString(logs.Blue(bl.Frameworks.String())) - line.WriteString(logs.Blue(bl.Extracteds.String())) + line.WriteString(logs.Cyan(bl.Frameworks.String())) + line.WriteString(logs.Cyan(bl.Extracteds.String())) if bl.RedirectURL != "" { line.WriteString(" --> ") line.WriteString(logs.CyanLine(bl.RedirectURL)) diff --git a/pkg/ihttp/client.go b/pkg/ihttp/client.go index 10f29cb..11c6078 100644 --- a/pkg/ihttp/client.go +++ b/pkg/ihttp/client.go @@ -31,7 +31,7 @@ func NewClient(thread int, timeout int, clientType int) *Client { MaxConnWaitTimeout: time.Duration(timeout) * time.Second, ReadTimeout: time.Duration(timeout) * time.Second, WriteTimeout: time.Duration(timeout) * time.Second, - ReadBufferSize: 8192, + ReadBufferSize: 16384, MaxResponseBodySize: DefaultMaxBodySize, NoDefaultUserAgentHeader: true, DisablePathNormalizing: true,