这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest

Subfinder will work after using the installation instructions however to configure Subfinder to work with certain services, you will need to have setup API keys. The following services do not work without an API key:

[BeVigil](https://bevigil.com/osint-api), [Binaryedge](https://binaryedge.io), [C99](https://api.c99.nl/), [Certspotter](https://sslmate.com/certspotter/api/), [Chinaz](http://my.chinaz.com/ChinazAPI/DataCenter/MyDataApi), [Censys](https://censys.io), [Chaos](https://chaos.projectdiscovery.io), [DnsDB](https://api.dnsdb.info), [Fofa](https://fofa.info/static_pages/api_help), [Github](https://github.com), [Intelx](https://intelx.io), [Passivetotal](http://passivetotal.org), [Robtex](https://www.robtex.com/api/), [SecurityTrails](http://securitytrails.com), [Shodan](https://shodan.io), [Threatbook](https://x.threatbook.cn/en), [Virustotal](https://www.virustotal.com), [WhoisXML API](https://whoisxmlapi.com/), [Zoomeye](https://www.zoomeye.org)
[BeVigil](https://bevigil.com/osint-api), [Binaryedge](https://binaryedge.io), [C99](https://api.c99.nl/), [Certspotter](https://sslmate.com/certspotter/api/), [Chinaz](http://my.chinaz.com/ChinazAPI/DataCenter/MyDataApi), [Censys](https://censys.io), [Chaos](https://chaos.projectdiscovery.io), [DnsDB](https://api.dnsdb.info), [Fofa](https://fofa.info/static_pages/api_help), [Github](https://github.com), [Intelx](https://intelx.io), [Passivetotal](http://passivetotal.org), [Robtex](https://www.robtex.com/api/), [SecurityTrails](http://securitytrails.com), [Shodan](https://shodan.io), [Threatbook](https://x.threatbook.cn/en), [Virustotal](https://www.virustotal.com), [WhoisXML API](https://whoisxmlapi.com/), [Zoomeye](https://www.zoomeye.org), [Recon.Cloud](https://recon.cloud/)

These values are stored in the `$HOME/.config/subfinder/provider-config.yaml` file which will be created when you run the tool for the first time. The configuration file uses the YAML format. Multiple API keys can be specified for each of these services from which one of them will be used for enumeration.

Expand Down
2 changes: 2 additions & 0 deletions v2/pkg/passive/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/passivetotal"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/quake"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/rapiddns"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/reconcloud"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/riddler"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/robtex"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/securitytrails"
Expand Down Expand Up @@ -83,6 +84,7 @@ var AllSources = [...]subscraping.Source{
&zoomeye.Source{},
&zoomeyeapi.Source{},
&dnsrepo.Source{},
&reconcloud.Source{},
}

var NameSourceMap = make(map[string]subscraping.Source, len(AllSources))
Expand Down
7 changes: 5 additions & 2 deletions v2/pkg/passive/sources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
"whoisxmlapi",
"zoomeye",
"zoomeyeapi",
"reconcloud",
}

expectedDefaultSources = []string{
Expand Down Expand Up @@ -75,6 +76,7 @@ var (
"threatminer",
"virustotal",
"whoisxmlapi",
"reconcloud",
}

expectedDefaultRecursiveSources = []string{
Expand All @@ -89,6 +91,7 @@ var (
"securitytrails",
"sonarsearch",
"virustotal",
"reconcloud",
}
)

Expand Down Expand Up @@ -134,13 +137,13 @@ func TestSourceFiltering(t *testing.T) {
{someSources, someExclusions, false, false, len(someSources) - len(someExclusions)},
{someSources, someExclusions, false, true, 1},
{someSources, someExclusions, true, false, len(AllSources) - len(someExclusions)},
{someSources, someExclusions, true, true, 9},
{someSources, someExclusions, true, true, 10},

{someSources, []string{}, false, false, len(someSources)},
{someSources, []string{}, true, false, len(AllSources)},

{[]string{}, []string{}, false, false, len(expectedDefaultSources)},
{[]string{}, []string{}, false, true, 9},
{[]string{}, []string{}, false, true, 10},
{[]string{}, []string{}, true, false, len(AllSources)},
{[]string{}, []string{}, true, true, len(expectedDefaultRecursiveSources)},
}
Expand Down
81 changes: 81 additions & 0 deletions v2/pkg/subscraping/sources/reconcloud/reconcloud.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Package reconcloud logic
package reconcloud

import (
"context"
"fmt"

jsoniter "github.com/json-iterator/go"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping"
)

type reconCloudResponse struct {
MsgType string `json:"msg_type"`
RequestID string `json:"request_id"`
OnCache bool `json:"on_cache"`
Step string `json:"step"`
CloudAssetsList []cloudAssetsList `json:"cloud_assets_list"`
}

type cloudAssetsList struct {
Key string `json:"key"`
Domain string `json:"domain"`
CloudProvider string `json:"cloud_provider"`
}

// Source is the passive scraping agent
type Source struct{}

// 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)

go func() {
defer close(results)

resp, err := session.SimpleGet(ctx, fmt.Sprintf("https://recon.cloud/api/search?domain=%s", domain))
if err != nil && resp == nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
session.DiscardHTTPResponse(resp)
return
}

var response reconCloudResponse
err = jsoniter.NewDecoder(resp.Body).Decode(&response)
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
resp.Body.Close()
return
}
resp.Body.Close()

if len(response.CloudAssetsList) > 0 {
for _, cloudAsset := range response.CloudAssetsList {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: cloudAsset.Domain}
}
}
}()

return results
}

// Name returns the name of the source
func (s *Source) Name() string {
return "reconcloud"
}

func (s *Source) IsDefault() bool {
return true
}

func (s *Source) HasRecursiveSupport() bool {
return true
}

func (s *Source) NeedsKey() bool {
return false
}

func (s *Source) AddApiKeys(_ []string) {
// no key needed
}