From 63f39b65dccfe89eead7961b38c9493c5279c654 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 17 Feb 2021 18:28:55 +0100 Subject: [PATCH 1/2] passive total bugfix --- v2/pkg/subscraping/sources/passivetotal/passivetotal.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/v2/pkg/subscraping/sources/passivetotal/passivetotal.go b/v2/pkg/subscraping/sources/passivetotal/passivetotal.go index 76495a3..45c7a28 100755 --- a/v2/pkg/subscraping/sources/passivetotal/passivetotal.go +++ b/v2/pkg/subscraping/sources/passivetotal/passivetotal.go @@ -3,6 +3,7 @@ package passivetotal import ( "bytes" "context" + "regexp" jsoniter "github.com/json-iterator/go" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping" @@ -54,6 +55,10 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se resp.Body.Close() for _, subdomain := range data.Subdomains { + // skip entries like xxx.xxx.xxx.xxx\032domain.tld + if passiveTotalFilterRegex.MatchString(subdomain) { + continue + } finalSubdomain := subdomain + "." + domain results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: finalSubdomain} } @@ -66,3 +71,5 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se func (s *Source) Name() string { return "passivetotal" } + +var passiveTotalFilterRegex *regexp.Regexp = regexp.MustCompile(`^(?:[0-9]{1,3}\.){3}[0-9]{1,3}\\032`) From 836e5a8c0e93bc4ad087a2edbc75c68778f84175 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 17 Feb 2021 18:31:57 +0100 Subject: [PATCH 2/2] simplified regex --- v2/pkg/subscraping/sources/passivetotal/passivetotal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/pkg/subscraping/sources/passivetotal/passivetotal.go b/v2/pkg/subscraping/sources/passivetotal/passivetotal.go index 45c7a28..1c7c7ae 100755 --- a/v2/pkg/subscraping/sources/passivetotal/passivetotal.go +++ b/v2/pkg/subscraping/sources/passivetotal/passivetotal.go @@ -72,4 +72,4 @@ func (s *Source) Name() string { return "passivetotal" } -var passiveTotalFilterRegex *regexp.Regexp = regexp.MustCompile(`^(?:[0-9]{1,3}\.){3}[0-9]{1,3}\\032`) +var passiveTotalFilterRegex *regexp.Regexp = regexp.MustCompile(`^(?:\d{1,3}\.){3}\d{1,3}\\032`)