Fixed shodan module in order to correctly reflect all results

master
thezoomerr 2021-02-15 09:58:18 -08:00
parent c97d45fc6d
commit f346a3a278
1 changed files with 6 additions and 16 deletions

View File

@ -12,14 +12,10 @@ import (
type Source struct{}
type dnsdbLookupResponse struct {
Domain string `json:"domain"`
Data []struct {
Subdomain string `json:"subdomain"`
Type string `json:"type"`
Value string `json:"value"`
} `json:"data"`
Result int `json:"result"`
Error string `json:"error"`
Domain string `json:"domain"`
Subdomains []string `json:"subdomains"`
Result int `json:"result"`
Error string `json:"error"`
}
// Run function returns all subdomains found with the service
@ -54,14 +50,8 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
return
}
for _, data := range response.Data {
if data.Subdomain != "" {
if data.Type == "CNAME" {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: data.Value}
} else if data.Type == "A" {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: fmt.Sprintf("%s.%s", data.Subdomain, domain)}
}
}
for _, data := range response.Subdomains {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: fmt.Sprintf("%s.%s", data, domain)}
}
}()