diff --git a/internal/dnslookup/dnslookup.go b/internal/dnslookup/dnslookup.go index 88283fc..255a704 100644 --- a/internal/dnslookup/dnslookup.go +++ b/internal/dnslookup/dnslookup.go @@ -26,12 +26,6 @@ func GetDNSRecords(hostname string) []models.DNSRecord { currentHost := hostname isWildcard := false - if strings.HasPrefix(hostname, "*.") { - randomSubdomain := randomHostname() - currentHost = randomSubdomain + hostname[1:] - isWildcard = true - } - // CNAME lookup cname, err := net.LookupCNAME(currentHost) if err == nil && cname != currentHost+"." { @@ -42,6 +36,12 @@ func GetDNSRecords(hostname string) []models.DNSRecord { currentHost = cname } + if strings.HasPrefix(currentHost, "*.") { + randomSubdomain := randomHostname() + currentHost = randomSubdomain + hostname[1:] + isWildcard = true + } + // A and AAAA lookup ips, err := net.LookupIP(currentHost)