Files
assetfinder/certspotter.go
2020-07-24 22:37:25 +01:00

26 lines
474 B
Go

package assetfinder
import "fmt"
type CertSpotter struct{}
func (CertSpotter) FetchSubDomains(domain string) ([]string, error) {
out := make([]string, 0)
fetchURL := fmt.Sprintf("https://certspotter.com/api/v0/certs?domain=%s", domain)
wrapper := []struct {
DNSNames []string `json:"dns_names"`
}{}
err := fetchJSON(fetchURL, &wrapper)
if err != nil {
return out, err
}
for _, w := range wrapper {
out = append(out, w.DNSNames...)
}
return out, nil
}