diff --git a/internal/checkpool.go b/internal/checkpool.go index f756c72..8febfd6 100644 --- a/internal/checkpool.go +++ b/internal/checkpool.go @@ -56,7 +56,7 @@ func NewCheckPool(ctx context.Context, config *pkg.Config) (*CheckPool, error) { bl = pkg.NewBaseline(req.URI(), req.Host(), resp) bl.Collect() } - + bl.Source = unit.source bl.Spended = time.Since(start).Milliseconds() pool.OutputCh <- bl pool.reqCount++ diff --git a/internal/option.go b/internal/option.go index 6229c48..6b88f9b 100644 --- a/internal/option.go +++ b/internal/option.go @@ -29,13 +29,13 @@ type Option struct { } type InputOptions struct { - ResumeFrom string `long:"resume"` - URL []string `short:"u" long:"url" description:"Strings, input baseurl, e.g.: http://google.com"` - URLFile string `short:"l" long:"list" description:"File, input filename"` - Raw string `long:"raw" description:"File, input raw request filename"` + ResumeFrom string `long:"resume"` + URL []string `short:"u" long:"url" description:"Strings, input baseurl, e.g.: http://google.com"` + URLFile string `short:"l" long:"list" description:"File, input filename"` + //Raw string `long:"raw" description:"File, input raw request filename"` + Dictionaries []string `short:"d" long:"dict" description:"Files, Multi,dict files, e.g.: -d 1.txt -d 2.txt"` Offset int `long:"offset" description:"Int, wordlist offset"` Limit int `long:"limit" description:"Int, wordlist limit, start with offset. e.g.: --offset 1000 --limit 100"` - Dictionaries []string `short:"d" long:"dict" description:"Files, Multi,dict files, e.g.: -d 1.txt -d 2.txt"` Word string `short:"w" long:"word" description:"String, word generate dsl, e.g.: -w test{?ld#4}"` Rules []string `short:"r" long:"rules" description:"Files, rule files, e.g.: -r rule1.txt -r rule2.txt"` AppendRule []string `long:"append-rule" description:"Files, when found valid path , use append rule generator new word with current path"` @@ -369,11 +369,13 @@ func (opt *Option) PrepareRunner() (*Runner, error) { if err != nil { return nil, err } - urls := strings.Split(strings.TrimSpace(string(content)), "\n") - for _, u := range urls { - tasks = append(tasks, &Task{baseUrl: strings.TrimSpace(u)}) + urls = strings.Split(strings.TrimSpace(string(content)), "\n") + for i, u := range urls { + urls[i] = strings.TrimSpace(u) + tasks = append(tasks, &Task{baseUrl: urls[i]}) } } + if opt.CheckOnly { r.URLList = urls r.Total = len(r.URLList) diff --git a/internal/pool.go b/internal/pool.go index 9e4c533..7cb6986 100644 --- a/internal/pool.go +++ b/internal/pool.go @@ -468,7 +468,7 @@ func (pool *Pool) PreCompare(resp *ihttp.Response) error { // 如果为白名单状态码则直接返回 return nil } - if pool.random != nil && pool.random.Status != 200 && pool.random.Status == status { + if pool.random.Status != 200 && pool.random.Status == status { return ErrSameStatus } diff --git a/internal/runner.go b/internal/runner.go index 30160cc..20c2aae 100644 --- a/internal/runner.go +++ b/internal/runner.go @@ -137,6 +137,7 @@ func (r *Runner) Prepare(ctx context.Context) error { r.poolwg.Done() }) } else { + // spray 完整探测模式 go func() { for _, t := range r.Tasks { r.taskCh <- t diff --git a/pkg/utils.go b/pkg/utils.go index f7b873f..ee40e81 100644 --- a/pkg/utils.go +++ b/pkg/utils.go @@ -70,6 +70,7 @@ func RemoveDuplication(arr []string) []string { return arr[:j] } +// 判断是否存在标准输入数据 func HasStdin() bool { stat, err := os.Stdin.Stat() if err != nil {