From 6987238bf2809a36c3840b637e70ee636b2458b4 Mon Sep 17 00:00:00 2001 From: zanbin168 Date: Wed, 5 Apr 2023 17:35:40 +0800 Subject: [PATCH] 2.2.2 --- cmd/afrog/main.go | 1 + pkg/config/config.go | 2 +- pkg/config/options.go | 3 +++ pkg/core/checker.go | 5 +---- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/afrog/main.go b/cmd/afrog/main.go index 750bb913..71f66ee4 100644 --- a/cmd/afrog/main.go +++ b/cmd/afrog/main.go @@ -114,6 +114,7 @@ func readConfig() { flagSet.BoolVarP(&options.NoFinger, "nofinger", "nf", false, "disable fingerprint"), flagSet.IntVar(&options.Retries, "retries", 1, "number of times to retry a failed request"), flagSet.IntVar(&options.Timeout, "timeout", 10, "time to wait in seconds before timeout"), + flagSet.IntVar(&options.MaxHostNum, "mhe", 3, "max errors for a host before skipping from scan"), ) flagSet.CreateGroup("update", "Update", diff --git a/pkg/config/config.go b/pkg/config/config.go index d8c00b72..a092d6ef 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -40,7 +40,7 @@ type Ceye struct { } const afrogConfigFilename = "afrog-config.yaml" -const Version = "2.2.1" +const Version = "2.2.2" // Create and initialize afrog-config.yaml configuration info func New() (*Config, error) { diff --git a/pkg/config/options.go b/pkg/config/options.go index e2809a3d..3a333e0e 100644 --- a/pkg/config/options.go +++ b/pkg/config/options.go @@ -79,6 +79,9 @@ type Options struct { // number of times to retry a failed request (default 1) Retries int + // + MaxHostNum int + // time to wait in seconds before timeout (default 10) Timeout int diff --git a/pkg/core/checker.go b/pkg/core/checker.go index 54dac260..b4476fd9 100644 --- a/pkg/core/checker.go +++ b/pkg/core/checker.go @@ -166,14 +166,11 @@ func (c *Checker) Check(ctx context.Context, target string, pocItem *poc.Poc) (e return err } -var MaxCheckNum = 1 - func (c *Checker) checkURL(target string) (string, error) { var err error // if target check num more than MaxCheckNum - if c.Options.Targets.Num(target) > MaxCheckNum { - fmt.Printf("%s is blacklisted\n", target) + if c.Options.Targets.Num(target) > c.Options.MaxHostNum { return "", fmt.Errorf("%s is blacklisted", target) }