From ffd387a28e8129a45b92d7d6133961db7959323f Mon Sep 17 00:00:00 2001 From: M09Ic Date: Wed, 4 Jan 2023 00:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96options=E7=9A=84=E7=BB=86?= =?UTF-8?q?=E8=8A=82,=20=E9=80=92=E5=BD=92=E6=B7=B1=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/option.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/option.go b/internal/option.go index c52cf68..fd6b6cc 100644 --- a/internal/option.go +++ b/internal/option.go @@ -30,7 +30,7 @@ type Option struct { } type InputOptions struct { - ResumeFrom string `long:"resume-from"` + ResumeFrom string `long:"resume"` URL string `short:"u" long:"url" description:"String, input baseurl (separated by commas), e.g.: http://google.com, http://baidu.com"` URLFile string `short:"l" long:"list" description:"File, input filename"` Raw string `long:"raw" description:"File, input raw request filename"` @@ -82,7 +82,7 @@ type ModeOptions struct { Depth int `long:"depth" default:"0" description:"Int, recursive depth"` Active bool `long:"active" description:"Bool, enable active finger detect"` Crawl bool `long:"crawl" description:"Bool, enable crawl"` - CrawlDepth int `long:"spider-depth" default:"3" description:"Int, crawl depth"` + CrawlDepth int `long:"crawl-depth" default:"3" description:"Int, crawl depth"` CheckPeriod int `long:"check-period" default:"200" description:"Int, check period when request"` ErrPeriod int `long:"error-period" default:"10" description:"Int, check period when error"` BreakThreshold int `long:"error-threshold" default:"20" description:"Int, break when the error exceeds the threshold "` @@ -400,13 +400,17 @@ func (opt *Option) PrepareRunner() (*Runner, error) { r.FilterExpr = exp } - if opt.Depth > 0 { + if opt.Recursive != "current.IsDir()" { + maxRecursion = 1 exp, err := expr.Compile(opt.Recursive) if err != nil { return nil, err } r.RecursiveExpr = exp } + if opt.Depth != 0 { + maxRecursion = opt.Depth + } // prepare header for _, h := range opt.Headers {