新增--max-length参数, 允许手动调整最大读取的body

This commit is contained in:
M09Ic 2023-01-03 17:30:14 +08:00
parent 3d9e994c78
commit 900dca32cb
3 changed files with 7 additions and 6 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/chainreactors/gogo/v2/pkg/fingers" "github.com/chainreactors/gogo/v2/pkg/fingers"
"github.com/chainreactors/logs" "github.com/chainreactors/logs"
"github.com/chainreactors/spray/pkg" "github.com/chainreactors/spray/pkg"
"github.com/chainreactors/spray/pkg/ihttp"
"github.com/chainreactors/words/mask" "github.com/chainreactors/words/mask"
"github.com/chainreactors/words/rule" "github.com/chainreactors/words/rule"
"github.com/gosuri/uiprogress" "github.com/gosuri/uiprogress"
@ -71,6 +72,7 @@ type RequestOptions struct {
//RandomUserAgent bool `long:"random-agent" description:"Bool, use random with default user-agent"` //RandomUserAgent bool `long:"random-agent" description:"Bool, use random with default user-agent"`
//Method string `long:"method" default:"GET" description:"String, custom method"` //Method string `long:"method" default:"GET" description:"String, custom method"`
//Cookie string `long:"cookie" description:"String, custom cookie"` //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 { type ModeOptions struct {
@ -168,9 +170,8 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
r.Progress.Start() r.Progress.Start()
logs.Log.Writer = r.Progress.Bypass() 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 { if opt.Force {
// 如果开启了force模式, 将关闭check机制, err积累到一定数量自动退出机制 // 如果开启了force模式, 将关闭check机制, err积累到一定数量自动退出机制

View File

@ -323,8 +323,8 @@ func (bl *Baseline) ColorString() string {
line.WriteString(" - ") line.WriteString(" - ")
line.WriteString(logs.YellowBold(strconv.Itoa(int(bl.Spended)) + "ms")) line.WriteString(logs.YellowBold(strconv.Itoa(int(bl.Spended)) + "ms"))
line.WriteString(logs.GreenLine(bl.Additional("title"))) line.WriteString(logs.GreenLine(bl.Additional("title")))
line.WriteString(logs.Blue(bl.Frameworks.String())) line.WriteString(logs.Cyan(bl.Frameworks.String()))
line.WriteString(logs.Blue(bl.Extracteds.String())) line.WriteString(logs.Cyan(bl.Extracteds.String()))
if bl.RedirectURL != "" { if bl.RedirectURL != "" {
line.WriteString(" --> ") line.WriteString(" --> ")
line.WriteString(logs.CyanLine(bl.RedirectURL)) line.WriteString(logs.CyanLine(bl.RedirectURL))

View File

@ -31,7 +31,7 @@ func NewClient(thread int, timeout int, clientType int) *Client {
MaxConnWaitTimeout: time.Duration(timeout) * time.Second, MaxConnWaitTimeout: time.Duration(timeout) * time.Second,
ReadTimeout: time.Duration(timeout) * time.Second, ReadTimeout: time.Duration(timeout) * time.Second,
WriteTimeout: time.Duration(timeout) * time.Second, WriteTimeout: time.Duration(timeout) * time.Second,
ReadBufferSize: 8192, ReadBufferSize: 16384,
MaxResponseBodySize: DefaultMaxBodySize, MaxResponseBodySize: DefaultMaxBodySize,
NoDefaultUserAgentHeader: true, NoDefaultUserAgentHeader: true,
DisablePathNormalizing: true, DisablePathNormalizing: true,