diff --git a/v2/pkg/subscraping/sources/shodan/shodan.go b/v2/pkg/subscraping/sources/shodan/shodan.go index 31c68f7..0ccb624 100644 --- a/v2/pkg/subscraping/sources/shodan/shodan.go +++ b/v2/pkg/subscraping/sources/shodan/shodan.go @@ -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)} } }()