mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
support csv and fix fuzzy output
This commit is contained in:
parent
b4c6a77a98
commit
4a0c8f86eb
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
|||||||
github.com/chainreactors/files v0.0.0-20240716182835-7884ee1e77f0
|
github.com/chainreactors/files v0.0.0-20240716182835-7884ee1e77f0
|
||||||
github.com/chainreactors/fingers v0.0.0-20240716172449-2fc3147b9c2a
|
github.com/chainreactors/fingers v0.0.0-20240716172449-2fc3147b9c2a
|
||||||
github.com/chainreactors/logs v0.0.0-20240207121836-c946f072f81f
|
github.com/chainreactors/logs v0.0.0-20240207121836-c946f072f81f
|
||||||
github.com/chainreactors/parsers v0.0.0-20240708072709-07deeece7ce2
|
github.com/chainreactors/parsers v0.0.0-20240829055950-923f89a92b84
|
||||||
github.com/chainreactors/utils v0.0.0-20240805193040-ff3b97aa3c3f
|
github.com/chainreactors/utils v0.0.0-20240805193040-ff3b97aa3c3f
|
||||||
github.com/chainreactors/words v0.4.1-0.20240510105042-5ba5c2edc508
|
github.com/chainreactors/words v0.4.1-0.20240510105042-5ba5c2edc508
|
||||||
github.com/expr-lang/expr v1.16.9
|
github.com/expr-lang/expr v1.16.9
|
||||||
|
4
go.sum
4
go.sum
@ -93,6 +93,10 @@ github.com/chainreactors/logs v0.0.0-20240207121836-c946f072f81f/go.mod h1:6Mv6W
|
|||||||
github.com/chainreactors/parsers v0.0.0-20240702104902-1ce563b7ef76/go.mod h1:G/XLE5RAaUdqADkbhQ59mPrUAbsJLiQ2DN6CwtwNpBQ=
|
github.com/chainreactors/parsers v0.0.0-20240702104902-1ce563b7ef76/go.mod h1:G/XLE5RAaUdqADkbhQ59mPrUAbsJLiQ2DN6CwtwNpBQ=
|
||||||
github.com/chainreactors/parsers v0.0.0-20240708072709-07deeece7ce2 h1:sE3SChgHLtPsEaqHo5tDSy8niDys1SO174C4eHlShSw=
|
github.com/chainreactors/parsers v0.0.0-20240708072709-07deeece7ce2 h1:sE3SChgHLtPsEaqHo5tDSy8niDys1SO174C4eHlShSw=
|
||||||
github.com/chainreactors/parsers v0.0.0-20240708072709-07deeece7ce2/go.mod h1:7rXdYz6jrdjF0WUH1ICcAXKIKKjKmJo2PU8u43V7jkA=
|
github.com/chainreactors/parsers v0.0.0-20240708072709-07deeece7ce2/go.mod h1:7rXdYz6jrdjF0WUH1ICcAXKIKKjKmJo2PU8u43V7jkA=
|
||||||
|
github.com/chainreactors/parsers v0.0.0-20240825154421-240ad7eba29d h1:/rtYIkD9F1Va7YbAaHEPpLSOjsEEfqow6FKL/gcO5ns=
|
||||||
|
github.com/chainreactors/parsers v0.0.0-20240825154421-240ad7eba29d/go.mod h1:7rXdYz6jrdjF0WUH1ICcAXKIKKjKmJo2PU8u43V7jkA=
|
||||||
|
github.com/chainreactors/parsers v0.0.0-20240829055950-923f89a92b84 h1:F6umsdHLxKILxrH5wY2zVYwxMmb8XdCEc9apf7GWpOk=
|
||||||
|
github.com/chainreactors/parsers v0.0.0-20240829055950-923f89a92b84/go.mod h1:7rXdYz6jrdjF0WUH1ICcAXKIKKjKmJo2PU8u43V7jkA=
|
||||||
github.com/chainreactors/utils v0.0.0-20240528085651-ba1b255482c1/go.mod h1:JA4eiQZm+7AsfjXBcIzIdVKBEhDCb16eNtWFCGTxlvs=
|
github.com/chainreactors/utils v0.0.0-20240528085651-ba1b255482c1/go.mod h1:JA4eiQZm+7AsfjXBcIzIdVKBEhDCb16eNtWFCGTxlvs=
|
||||||
github.com/chainreactors/utils v0.0.0-20240704062557-662d623b74f4/go.mod h1:JA4eiQZm+7AsfjXBcIzIdVKBEhDCb16eNtWFCGTxlvs=
|
github.com/chainreactors/utils v0.0.0-20240704062557-662d623b74f4/go.mod h1:JA4eiQZm+7AsfjXBcIzIdVKBEhDCb16eNtWFCGTxlvs=
|
||||||
github.com/chainreactors/utils v0.0.0-20240715080349-d2d0484c95ed/go.mod h1:LajXuvESQwP+qCMAvlcoSXppQCjuLlBrnQpu9XQ1HtU=
|
github.com/chainreactors/utils v0.0.0-20240715080349-d2d0484c95ed/go.mod h1:LajXuvESQwP+qCMAvlcoSXppQCjuLlBrnQpu9XQ1HtU=
|
||||||
|
@ -87,7 +87,8 @@ type OutputOptions struct {
|
|||||||
AutoFile bool `long:"auto-file" description:"Bool, auto generator output and fuzzy filename" config:"auto-file"`
|
AutoFile bool `long:"auto-file" description:"Bool, auto generator output and fuzzy filename" config:"auto-file"`
|
||||||
Format string `short:"F" long:"format" description:"String, output format, e.g.: --format 1.json" config:"format"`
|
Format string `short:"F" long:"format" description:"String, output format, e.g.: --format 1.json" config:"format"`
|
||||||
Json bool `short:"j" long:"json" description:"Bool, output json" config:"json"`
|
Json bool `short:"j" long:"json" description:"Bool, output json" config:"json"`
|
||||||
OutputProbe string `short:"o" long:"probe" description:"String, output format" config:"output_probe"`
|
FileOutput string `short:"O" long:"file-output" default:"json" description:"Bool, file output format" config:"file_output"`
|
||||||
|
OutputProbe string `short:"o" long:"probe" description:"String, output format" config:"output"`
|
||||||
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet" config:"quiet"`
|
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet" config:"quiet"`
|
||||||
NoColor bool `long:"no-color" description:"Bool, no color" config:"no-color"`
|
NoColor bool `long:"no-color" description:"Bool, no color" config:"no-color"`
|
||||||
NoBar bool `long:"no-bar" description:"Bool, No progress bar" config:"no-bar"`
|
NoBar bool `long:"no-bar" description:"Bool, No progress bar" config:"no-bar"`
|
||||||
@ -164,7 +165,6 @@ func (opt *Option) Validate() error {
|
|||||||
|
|
||||||
if opt.Depth > 0 && opt.ResumeFrom != "" {
|
if opt.Depth > 0 && opt.ResumeFrom != "" {
|
||||||
// 递归与断点续传会造成混淆, 断点续传的word与rule不是通过命令行获取的
|
// 递归与断点续传会造成混淆, 断点续传的word与rule不是通过命令行获取的
|
||||||
|
|
||||||
return errors.New("--resume and --depth cannot be used at the same time")
|
return errors.New("--resume and --depth cannot be used at the same time")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ func (r *Runner) saveStat(content string) {
|
|||||||
func (r *Runner) Output(bl *pkg.Baseline) {
|
func (r *Runner) Output(bl *pkg.Baseline) {
|
||||||
var out string
|
var out string
|
||||||
if r.Option.Json {
|
if r.Option.Json {
|
||||||
out = bl.Jsonify()
|
out = bl.ToJson()
|
||||||
} else if len(r.Probes) > 0 {
|
} else if len(r.Probes) > 0 {
|
||||||
out = bl.Format(r.Probes)
|
out = bl.Format(r.Probes)
|
||||||
} else if r.Color {
|
} else if r.Color {
|
||||||
@ -364,14 +364,20 @@ func (r *Runner) Output(bl *pkg.Baseline) {
|
|||||||
out = bl.String()
|
out = bl.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
if bl.IsFuzzy {
|
if bl.IsValid {
|
||||||
logs.Log.Console("[fuzzy] " + out + "\n")
|
|
||||||
} else {
|
|
||||||
logs.Log.Console(out + "\n")
|
logs.Log.Console(out + "\n")
|
||||||
|
|
||||||
|
} else if r.Fuzzy && bl.IsFuzzy {
|
||||||
|
logs.Log.Console("[fuzzy] " + out + "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.OutputFile != nil {
|
if r.OutputFile != nil {
|
||||||
r.OutputFile.SafeWrite(bl.Jsonify() + "\n")
|
if r.FileOutput == "json" {
|
||||||
|
r.OutputFile.SafeWrite(bl.ToJson() + "\n")
|
||||||
|
} else if r.FileOutput == "csv" {
|
||||||
|
r.OutputFile.SafeWrite(bl.ToCSV() + "\n")
|
||||||
|
}
|
||||||
|
|
||||||
r.OutputFile.SafeSync()
|
r.OutputFile.SafeSync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,7 +391,7 @@ func (r *Runner) OutputHandler() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if r.DumpFile != nil {
|
if r.DumpFile != nil {
|
||||||
r.DumpFile.SafeWrite(bl.Jsonify() + "\n")
|
r.DumpFile.SafeWrite(bl.ToJson() + "\n")
|
||||||
r.DumpFile.SafeSync()
|
r.DumpFile.SafeSync()
|
||||||
}
|
}
|
||||||
if bl.IsValid {
|
if bl.IsValid {
|
||||||
@ -412,10 +418,8 @@ func (r *Runner) OutputHandler() {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if r.Fuzzy {
|
r.Output(bl)
|
||||||
r.Output(bl)
|
r.outwg.Done()
|
||||||
r.outwg.Done()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user