From c44091f70b6ddea6fdb9edfeeec00350109721de Mon Sep 17 00:00:00 2001 From: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:23:05 -0400 Subject: [PATCH 1/2] Allow comments in domains file --- v2/pkg/runner/runner.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/v2/pkg/runner/runner.go b/v2/pkg/runner/runner.go index b66b68537..e021f7a8d 100644 --- a/v2/pkg/runner/runner.go +++ b/v2/pkg/runner/runner.go @@ -120,7 +120,18 @@ func (r *Runner) EnumerateMultipleDomainsWithCtx(ctx context.Context, reader io. ip, _ := regexp.Compile(`^([0-9\.]+$)`) for scanner.Scan() { domain, err := normalizeLowercase(scanner.Text()) + + if idx := strings.Index(domain, "#"); idx != -1 { + domain = domain[:idx] + } + domain = strings.TrimSpace(domain) + + if len(domain) < 1 { + continue; + } + isIp := ip.MatchString(domain) + if errors.Is(err, ErrEmptyInput) || (r.options.ExcludeIps && isIp) { continue } From 39852cda9a8b69242a0c229fc19391cd5639afa0 Mon Sep 17 00:00:00 2001 From: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:26:30 -0400 Subject: [PATCH 2/2] We no longer need to check errors.Is(err, ErrEmptyInput) --- v2/pkg/runner/runner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/pkg/runner/runner.go b/v2/pkg/runner/runner.go index e021f7a8d..5d2980f75 100644 --- a/v2/pkg/runner/runner.go +++ b/v2/pkg/runner/runner.go @@ -119,7 +119,7 @@ func (r *Runner) EnumerateMultipleDomainsWithCtx(ctx context.Context, reader io. scanner := bufio.NewScanner(reader) ip, _ := regexp.Compile(`^([0-9\.]+$)`) for scanner.Scan() { - domain, err := normalizeLowercase(scanner.Text()) + domain := normalizeLowercase(scanner.Text()) if idx := strings.Index(domain, "#"); idx != -1 { domain = domain[:idx] @@ -132,7 +132,7 @@ func (r *Runner) EnumerateMultipleDomainsWithCtx(ctx context.Context, reader io. isIp := ip.MatchString(domain) - if errors.Is(err, ErrEmptyInput) || (r.options.ExcludeIps && isIp) { + if (r.options.ExcludeIps && isIp) { continue }