From 256bc2e81eb33037a4b3e3c8d20201408154e4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Wed, 30 Oct 2024 13:11:48 +0300 Subject: [PATCH] remove columbus --- v2/pkg/passive/sources.go | 2 - v2/pkg/passive/sources_test.go | 2 - .../subscraping/sources/columbus/columbus.go | 92 ------------------- 3 files changed, 96 deletions(-) delete mode 100644 v2/pkg/subscraping/sources/columbus/columbus.go diff --git a/v2/pkg/passive/sources.go b/v2/pkg/passive/sources.go index 03ff7bdce..7e7f995e7 100644 --- a/v2/pkg/passive/sources.go +++ b/v2/pkg/passive/sources.go @@ -18,7 +18,6 @@ import ( "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/certspotter" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/chaos" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/chinaz" - "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/columbus" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/commoncrawl" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/crtsh" "github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/digitorus" @@ -62,7 +61,6 @@ var AllSources = [...]subscraping.Source{ &certspotter.Source{}, &chaos.Source{}, &chinaz.Source{}, - &columbus.Source{}, &commoncrawl.Source{}, &crtsh.Source{}, &digitorus.Source{}, diff --git a/v2/pkg/passive/sources_test.go b/v2/pkg/passive/sources_test.go index 3866c064e..c99716d58 100644 --- a/v2/pkg/passive/sources_test.go +++ b/v2/pkg/passive/sources_test.go @@ -21,7 +21,6 @@ var ( "certspotter", "chaos", "chinaz", - "columbus", "commoncrawl", "crtsh", "digitorus", @@ -67,7 +66,6 @@ var ( "censys", "chaos", "chinaz", - "columbus", "crtsh", "digitorus", "dnsdumpster", diff --git a/v2/pkg/subscraping/sources/columbus/columbus.go b/v2/pkg/subscraping/sources/columbus/columbus.go deleted file mode 100644 index 83432ab92..000000000 --- a/v2/pkg/subscraping/sources/columbus/columbus.go +++ /dev/null @@ -1,92 +0,0 @@ -// Package columbus logic -package columbus - -import ( - "context" - "fmt" - "time" - - jsoniter "github.com/json-iterator/go" - - "github.com/projectdiscovery/subfinder/v2/pkg/subscraping" -) - -// Source is the passive scraping agent -type Source struct { - timeTaken time.Duration - errors int - results int -} - -// Run function returns all subdomains found with the service -func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Session) <-chan subscraping.Result { - results := make(chan subscraping.Result) - s.errors = 0 - s.results = 0 - - go func() { - defer func(startTime time.Time) { - s.timeTaken = time.Since(startTime) - close(results) - }(time.Now()) - - resp, err := session.SimpleGet(ctx, fmt.Sprintf("https://columbus.elmasy.com/api/lookup/%s", domain)) - if err != nil { - results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err} - s.errors++ - session.DiscardHTTPResponse(resp) - return - } - - var subdomains []string - err = jsoniter.NewDecoder(resp.Body).Decode(&subdomains) - if err != nil { - results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err} - s.errors++ - resp.Body.Close() - return - } - - resp.Body.Close() - - for _, record := range subdomains { - if record == "" { - continue - } - results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: record + "." + domain} - s.results++ - } - - }() - - return results -} - -// Name returns the name of the source -func (s *Source) Name() string { - return "columbus" -} - -func (s *Source) IsDefault() bool { - return true -} - -func (s *Source) HasRecursiveSupport() bool { - return false -} - -func (s *Source) NeedsKey() bool { - return false -} - -func (s *Source) AddApiKeys(_ []string) { - // no key needed -} - -func (s *Source) Statistics() subscraping.Statistics { - return subscraping.Statistics{ - Errors: s.errors, - Results: s.results, - TimeTaken: s.timeTaken, - } -}