mirror of
https://github.com/cubixle/assetfinder.git
synced 2026-04-24 18:24:46 +01:00
33 lines
557 B
Go
33 lines
557 B
Go
package assetfinder
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type BufferOverrun struct{}
|
|
|
|
func (BufferOverrun) FetchSubDomains(domain string) ([]string, error) {
|
|
out := make([]string, 0)
|
|
|
|
fetchURL := fmt.Sprintf("https://dns.bufferover.run/dns?q=.%s", domain)
|
|
|
|
wrapper := struct {
|
|
Records []string `json:"FDNS_A"`
|
|
}{}
|
|
err := fetchJSON(fetchURL, &wrapper)
|
|
if err != nil {
|
|
return out, err
|
|
}
|
|
|
|
for _, r := range wrapper.Records {
|
|
parts := strings.SplitN(r, ",", 2)
|
|
if len(parts) != 2 {
|
|
continue
|
|
}
|
|
out = append(out, parts[1])
|
|
}
|
|
|
|
return out, nil
|
|
}
|