mirror of
https://github.com/cubixle/assetfinder.git
synced 2026-04-24 22:54:45 +01:00
26 lines
474 B
Go
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
|
|
}
|