mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
给help添加说明
This commit is contained in:
parent
eea66e919b
commit
8a71c1d35e
@ -19,11 +19,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Option struct {
|
type Option struct {
|
||||||
InputOptions
|
InputOptions `group:"Input Options"`
|
||||||
OutputOptions
|
OutputOptions `group:"Output Options"`
|
||||||
RequestOptions
|
RequestOptions `group:"Request Options"`
|
||||||
ModeOptions
|
ModeOptions `group:"Modify Options"`
|
||||||
MiscOptions
|
MiscOptions `group:"Miscellaneous Options"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InputOptions struct {
|
type InputOptions struct {
|
||||||
@ -47,9 +47,9 @@ type InputOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OutputOptions struct {
|
type OutputOptions struct {
|
||||||
Match string `long:"match" description:"String, "`
|
Match string `long:"match" description:"String, custom match function, e.g.: --match current.Status != 200"`
|
||||||
Filter string `long:"filter" description:"String, "`
|
Filter string `long:"filter" description:"String, custom filter function, e.g.: --filter current.Body contains 'hello'"`
|
||||||
Extracts []string `long:"extract" description:"String, "`
|
Extracts []string `long:"extract" description:"String, extract response, e.g.: --extract js --extract ip --extract version:(.*?)"`
|
||||||
OutputFile string `short:"f" description:"String, output filename"`
|
OutputFile string `short:"f" description:"String, output filename"`
|
||||||
FuzzyFile string `long:"fuzzy-file" description:"String, fuzzy output filename"`
|
FuzzyFile string `long:"fuzzy-file" description:"String, fuzzy output filename"`
|
||||||
Fuzzy bool `long:"fuzzy" description:"String, open fuzzy output"`
|
Fuzzy bool `long:"fuzzy" description:"String, open fuzzy output"`
|
||||||
@ -57,21 +57,25 @@ type OutputOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RequestOptions struct {
|
type RequestOptions struct {
|
||||||
Headers []string `long:"header"`
|
Headers []string `long:"header" description:"String, custom headers, e.g.: --headers 'Auth: example_auth'"`
|
||||||
Method string `long:"method"`
|
//UserAgent string `long:"user-agent" description:"String, custom user-agent, e.g.: --user-agent Custom"`
|
||||||
Cookie string `long:"cookie"`
|
//RandomUserAgent bool `long:"random-agent" description:"Bool, use random with default user-agent"`
|
||||||
SimhashDistance int `long:"distance" default:"5"`
|
//Method string `long:"method" default:"GET" description:"String, custom method"`
|
||||||
|
//Cookie string `long:"cookie" description:"String, custom cookie"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ModeOptions struct {
|
type ModeOptions struct {
|
||||||
Force bool `long:"force"`
|
Force bool `long:"force" description:"Bool, skip error break"`
|
||||||
CheckOnly bool `long:"check-only"`
|
CheckOnly bool `long:"check-only" description:"Bool, check only"`
|
||||||
CheckPeriod int `long:"check-period" default:"100"`
|
Recursive string `long:"recursive" default:"current.IsDir()" description:"String,custom recursive rule, e.g.: --recursive current.IsDir()"`
|
||||||
ErrPeriod int `long:"error-period" default:"10"`
|
Depth int `long:"depth" default:"0" description:"Int, recursive depth"`
|
||||||
BreakThreshold int `long:"error-threshold" default:"20"`
|
CheckPeriod int `long:"check-period" default:"100" description:"Int, check period when request"`
|
||||||
BlackStatus string `long:"black-status" default:"404,400,410"`
|
ErrPeriod int `long:"error-period" default:"10" description:"Int, check period when error"`
|
||||||
WhiteStatus string `long:"white-status" default:"200"`
|
BreakThreshold int `long:"error-threshold" default:"20" description:"Int, break when the error exceeds the threshold "`
|
||||||
FuzzyStatus string `long:"fuzzy-status" default:"403,500,501,502,503"`
|
BlackStatus string `long:"black-status" default:"404,400,410" description:"Strings (comma split),custom black status, "`
|
||||||
|
WhiteStatus string `long:"white-status" default:"200" description:"Strings (comma split), custom white status"`
|
||||||
|
FuzzyStatus string `long:"fuzzy-status" default:"403,500,501,502,503" description:"Strings (comma split), custom fuzzy status"`
|
||||||
|
SimhashDistance int `long:"distance" default:"5"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MiscOptions struct {
|
type MiscOptions struct {
|
||||||
@ -81,7 +85,7 @@ type MiscOptions struct {
|
|||||||
Threads int `short:"t" long:"thread" default:"20" description:"Int, number of threads per pool (seconds)"`
|
Threads int `short:"t" long:"thread" default:"20" description:"Int, number of threads per pool (seconds)"`
|
||||||
Debug bool `long:"debug" description:"Bool, output debug info"`
|
Debug bool `long:"debug" description:"Bool, output debug info"`
|
||||||
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet"`
|
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet"`
|
||||||
NoBar bool `long:"no-bar"`
|
NoBar bool `long:"no-bar" description:"Bool, No progress bar"`
|
||||||
Mod string `short:"m" long:"mod" default:"path" choice:"path" choice:"host" description:"String, path/host spray"`
|
Mod string `short:"m" long:"mod" default:"path" choice:"path" choice:"host" description:"String, path/host spray"`
|
||||||
Client string `short:"c" long:"client" default:"auto" choice:"fast" choice:"standard" choice:"auto" description:"String, Client type"`
|
Client string `short:"c" long:"client" default:"auto" choice:"fast" choice:"standard" choice:"auto" description:"String, Client type"`
|
||||||
}
|
}
|
||||||
@ -359,6 +363,12 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
r.FilterExpr = exp
|
r.FilterExpr = exp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exp, err := expr.Compile(opt.Recursive)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
r.RecursiveExpr = exp
|
||||||
|
|
||||||
// prepare header
|
// prepare header
|
||||||
for _, h := range opt.Headers {
|
for _, h := range opt.Headers {
|
||||||
i := strings.Index(h, ":")
|
i := strings.Index(h, ":")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user