mirror of
https://github.com/cubixle/assetfinder.git
synced 2026-04-24 23:04:47 +01:00
initial
This commit is contained in:
25
certspotter.go
Normal file
25
certspotter.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user