这是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
5 changes: 5 additions & 0 deletions v2/pkg/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type ConfigFile struct {
// ExcludeSources contains the sources to not include in the enumeration process
ExcludeSources []string `yaml:"exclude-sources,omitempty"`
// API keys for different sources
Bufferover []string `yaml:"bufferover"`
Binaryedge []string `yaml:"binaryedge"`
C99 []string `yaml:"c99"`
Censys []string `yaml:"censys"`
Expand Down Expand Up @@ -128,6 +129,10 @@ func (c *ConfigFile) GetKeys() subscraping.Keys {
keys.C99 = c.C99[rand.Intn(len(c.C99))]
}

if len(c.Bufferover) > 0 {
keys.Bufferover = c.Bufferover[rand.Intn(len(c.Bufferover))]
}

if len(c.Censys) > 0 {
censysKeys := c.Censys[rand.Intn(len(c.Censys))]
parts := strings.Split(censysKeys, ":")
Expand Down
19 changes: 13 additions & 6 deletions v2/pkg/subscraping/sources/bufferover/bufferover.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,25 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
results := make(chan subscraping.Result)

go func() {
// Run enumeration on subdomain dataset for historical SONAR datasets
s.getData(ctx, fmt.Sprintf("https://dns.bufferover.run/dns?q=.%s", domain), session, results)
s.getData(ctx, fmt.Sprintf("https://tls.bufferover.run/dns?q=.%s", domain), session, results)
defer close(results)

close(results)
// DNS data does not rely on an API key.
s.getData(ctx, fmt.Sprintf("https://dns.bufferover.run/dns?q=.%s", domain), "", session, results)

if session.Keys.Bufferover == "" {
return
}

// TLS data relies on an API key.
s.getData(ctx, fmt.Sprintf("https://tls.bufferover.run/dns?q=.%s", domain), session.Keys.Bufferover, session, results)
}()

return results
}

func (s *Source) getData(ctx context.Context, sourceURL string, session *subscraping.Session, results chan subscraping.Result) {
resp, err := session.SimpleGet(ctx, sourceURL)
func (s *Source) getData(ctx context.Context, sourceURL string, apiKey string, session *subscraping.Session, results chan subscraping.Result) {
resp, err := session.Get(ctx, sourceURL, "", map[string]string{"x-api-key": apiKey})

if err != nil && resp == nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
session.DiscardHTTPResponse(resp)
Expand Down
1 change: 1 addition & 0 deletions v2/pkg/subscraping/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Session struct {
// Keys contains the current API Keys we have in store
type Keys struct {
Binaryedge string `json:"binaryedge"`
Bufferover string `json:"bufferover"`
C99 string `json:"c99"`
CensysToken string `json:"censysUsername"`
CensysSecret string `json:"censysPassword"`
Expand Down