fix censys results

dnsrepo-source
Mark Ellzey 2021-12-21 19:06:00 -05:00
parent 17fd08b034
commit 05c8b1dabb
1 changed files with 6 additions and 6 deletions

View File

@ -45,7 +45,7 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
resp, err := session.HTTPRequest(
ctx,
"POST",
"https://www.censys.io/api/v1/search/certificates",
"https://search.censys.io/api/v1/search/certificates",
"",
map[string]string{"Content-Type": "application/json", "Accept": "application/json"},
bytes.NewReader(request),
@ -68,11 +68,6 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
resp.Body.Close()
// Exit the censys enumeration if max pages is reached
if currentPage >= censysResponse.Metadata.Pages || currentPage >= maxCensysPages {
break
}
for _, res := range censysResponse.Results {
for _, part := range res.Data {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: part}
@ -82,6 +77,11 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
}
}
// Exit the censys enumeration if max pages is reached
if currentPage >= censysResponse.Metadata.Pages || currentPage >= maxCensysPages {
break
}
currentPage++
}
}()