mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
初步实现-F
给--probe添加缩写-o
This commit is contained in:
parent
5dc8f7107f
commit
30a82a7657
@ -22,6 +22,11 @@ func Spray() {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if option.Format != "" {
|
||||
internal.Format(option.Format)
|
||||
os.Exit(0)
|
||||
}
|
||||
var runner *internal.Runner
|
||||
if option.ResumeFrom != "" {
|
||||
runner, err = option.PrepareRunner()
|
||||
|
29
internal/format.go
Normal file
29
internal/format.go
Normal file
@ -0,0 +1,29 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/chainreactors/logs"
|
||||
"github.com/chainreactors/spray/pkg"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func Format(filename string) {
|
||||
content, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var results []*pkg.Baseline
|
||||
for _, line := range bytes.Split(bytes.TrimSpace(content), []byte("\n")) {
|
||||
var result pkg.Baseline
|
||||
err := json.Unmarshal(line, &result)
|
||||
if err != nil {
|
||||
logs.Log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
results = append(results, &result)
|
||||
}
|
||||
for _, result := range results {
|
||||
logs.Log.Info(result.String())
|
||||
}
|
||||
}
|
@ -58,12 +58,13 @@ type OutputOptions struct {
|
||||
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:(.*?)" json:"extracts,omitempty"`
|
||||
OutputFile string `short:"f" description:"String, output filename" json:"output_file,omitempty"`
|
||||
Format string `short:"F" long:"format" description:"String, output format, e.g.: --format 1.json"`
|
||||
FuzzyFile string `long:"fuzzy-file" description:"String, fuzzy output filename" json:"fuzzy_file,omitempty"`
|
||||
DumpFile string `long:"dump-file" description:"String, dump all request, and write to filename"`
|
||||
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"`
|
||||
OutputProbe string `short:"o" long:"probe" description:"String, output format" json:"output_probe,omitempty"`
|
||||
}
|
||||
|
||||
type RequestOptions struct {
|
||||
@ -98,8 +99,8 @@ type MiscOptions struct {
|
||||
PoolSize int `short:"p" long:"pool" default:"5" description:"Int, Pool size"`
|
||||
Threads int `short:"t" long:"thread" default:"20" description:"Int, number of threads per pool"`
|
||||
Debug bool `long:"debug" description:"Bool, output debug info"`
|
||||
NoColor bool `long:"no-color" description:"Bool, no color"`
|
||||
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet"`
|
||||
NoColor bool `long:"no-color" description:"Bool, no color"`
|
||||
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"`
|
||||
Client string `short:"c" long:"client" default:"auto" choice:"fast" choice:"standard" choice:"auto" description:"String, Client type"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user