You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use dnsx library in my workflow written in go. When using the dnsx library I'm only able to resolve the subdomains and get A record data, while not able to find a way to get the cname records as well.
Attempting to replicate the below command using dnsx library:
echo subdomain.domain.com | dnsx -cname -a -resp -silent
Here is the sample code I got using chatgpt (only able to get A records):
package main
import (
"fmt"
"log"
"github.com/projectdiscovery/dnsx/libs/dnsx"
)
func main() {
domain := "3fateam.0.cloud.arrival.com"
// Initialize dnsx client
dnsClient, err := dnsx.New(dnsx.Options{
BaseResolvers: []string{"8.8.8.8:53"},
})
if err != nil {
log.Fatalf("Failed to create dns client: %v", err)
}
// Get A records
ips, err := dnsClient.Lookup(domain)
if err != nil {
log.Printf("Failed to lookup A records: %v", err)
} else {
for _, ip := range ips {
fmt.Printf("%s [A] [%s]\n", domain, ip)
}
}
// Get CNAME record
response, err := dnsClient.QueryOne(domain)
if err != nil {
log.Printf("Failed to lookup CNAME records: %v", err)
} else {
if len(response.CNAME) > 0 {
for _, cname := range response.CNAME {
fmt.Printf("%s [CNAME] [%s]\n", domain, cname)
}
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
I'm trying to use dnsx library in my workflow written in go. When using the dnsx library I'm only able to resolve the subdomains and get A record data, while not able to find a way to get the cname records as well.
Attempting to replicate the below command using dnsx library:
Here is the sample code I got using chatgpt (only able to get A records):
Thank you for your help in advance.
Beta Was this translation helpful? Give feedback.
All reactions