Merge pull request #478 from ycamper/censys_fix

fix censys results
dnsrepo-source
Sandeep Singh 2021-12-22 11:41:25 +05:30 committed by GitHub
commit 8062724bb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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++
}
}()