mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
新增--dump与--dump-file, 用来保存全部数据
This commit is contained in:
parent
db58771f49
commit
75c33e1135
@ -47,13 +47,16 @@ type InputOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OutputOptions struct {
|
type OutputOptions struct {
|
||||||
Match string `long:"match" description:"String, custom match function, e.g.: --match current.Status != 200"`
|
Match string `long:"match" description:"String, custom match function, e.g.: --match current.Status != 200" json:"match,omitempty"`
|
||||||
Filter string `long:"filter" description:"String, custom filter function, e.g.: --filter current.Body contains 'hello'"`
|
Filter string `long:"filter" description:"String, custom filter function, e.g.: --filter current.Body contains 'hello'" json:"filter,omitempty"`
|
||||||
Extracts []string `long:"extract" description:"String, extract response, e.g.: --extract js --extract ip --extract version:(.*?)"`
|
Extracts []string `long:"extract" description:"String, extract response, e.g.: --extract js --extract ip --extract version:(.*?)" json:"extracts,omitempty"`
|
||||||
OutputFile string `short:"f" description:"String, output filename"`
|
OutputFile string `short:"f" description:"String, output filename" json:"output_file,omitempty"`
|
||||||
FuzzyFile string `long:"fuzzy-file" description:"String, fuzzy output filename"`
|
FuzzyFile string `long:"fuzzy-file" description:"String, fuzzy output filename" json:"fuzzy_file,omitempty"`
|
||||||
Fuzzy bool `long:"fuzzy" description:"String, open fuzzy output"`
|
DumpFile string `long:"dump-file" description:"String, dump all request, and write to filename"`
|
||||||
OutputProbe string `long:"probe" description:"String, output format"`
|
Dump bool `long:"dump" description:"Bool, dump all request"`
|
||||||
|
AutoFile bool `long:"auto-file" description:"Bool, auto generator output and fuzzy filename" `
|
||||||
|
Fuzzy bool `long:"fuzzy" description:"String, open fuzzy output" json:"fuzzy,omitempty"`
|
||||||
|
OutputProbe string `long:"probe" description:"String, output format" json:"output_probe,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RequestOptions struct {
|
type RequestOptions struct {
|
||||||
@ -388,6 +391,11 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
} else if opt.AutoFile {
|
||||||
|
r.OutputFile, err = files.NewFile("result.json", true, false, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt.FuzzyFile != "" {
|
if opt.FuzzyFile != "" {
|
||||||
@ -395,8 +403,24 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
} else if opt.AutoFile {
|
||||||
|
r.FuzzyFile, err = files.NewFile("fuzzy.json", true, false, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opt.DumpFile != "" {
|
||||||
|
r.DumpFile, err = files.NewFile(opt.DumpFile, false, false, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else if opt.Dump {
|
||||||
|
r.DumpFile, err = files.NewFile("dump.json", true, false, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
r.StatFile, err = files.NewFile("stat.json", false, false, true)
|
r.StatFile, err = files.NewFile("stat.json", false, false, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -459,4 +483,6 @@ type Task struct {
|
|||||||
offset int
|
offset int
|
||||||
total int
|
total int
|
||||||
depth int
|
depth int
|
||||||
|
//wordlist []string
|
||||||
|
//rule []rule.Expression
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ type Runner struct {
|
|||||||
Fuzzy bool
|
Fuzzy bool
|
||||||
OutputFile *files.File
|
OutputFile *files.File
|
||||||
FuzzyFile *files.File
|
FuzzyFile *files.File
|
||||||
|
DumpFile *files.File
|
||||||
StatFile *files.File
|
StatFile *files.File
|
||||||
Force bool
|
Force bool
|
||||||
Progress *uiprogress.Progress
|
Progress *uiprogress.Progress
|
||||||
@ -278,7 +279,10 @@ func (r *Runner) Outputting() {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if r.DumpFile != nil {
|
||||||
|
r.DumpFile.SafeWrite(bl.Jsonify() + "\n")
|
||||||
|
r.DumpFile.SafeSync()
|
||||||
|
}
|
||||||
if bl.IsValid {
|
if bl.IsValid {
|
||||||
saveFunc(bl)
|
saveFunc(bl)
|
||||||
if bl.Recu {
|
if bl.Recu {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user