Ignore error in QueryMultiple
zt2 opened this issue · 2 comments
zt2 commented
I found the error that occurred in the QueryMultiple retry loop will return to the caller:
// QueryMultiple sends a provided dns request and return the data
func (c *Client) QueryMultiple(host string, requestTypes []uint16) (*DNSData, error) {
// ... ...
for _, requestType := range requestTypes {
// ... ...
for i := 0; i < c.maxRetries; i++ {
resolver := c.resolvers[rand.Intn(len(c.resolvers))]
var resp *dns.Msg
resp, err = dns.Exchange(&msg, resolver)
if err != nil {
// This error will be returned if current request is the last request
continue
}
dnsdata.Host = host
dnsdata.Raw += resp.String()
dnsdata.StatusCode = dns.RcodeToString[resp.Rcode]
dnsdata.Resolver = append(dnsdata.Resolver, resolver)
// In case we got some error from the server, return.
if resp != nil && resp.Rcode != dns.RcodeSuccess {
break
}
dnsdata.ParseFromMsg(resp)
break
}
}
dnsdata.dedupe()
// return to the caller
return &dnsdata, err
This behavior means QueryMultiple
will fail just because the last DNS request got a network problem, even all DNS requests before the last one succeed.
And so dnsx
will return nothing if give multiple DNS requests to dnsx
:
// Try more time
echo github.com | dnsx -mx -a -cname -aaaa -ns -soa -json
Mzack9999 commented
The problem is within dnsx at https://github.com/projectdiscovery/dnsx/blob/cf9498dfb27e0e6cb36b76a26bed506baf872b53/internal/runner/runner.go#L308
Mzack9999 commented
Closing as the issue is addressed in dnsx at projectdiscovery/dnsx#33 . Let us know if you still face problems, thanks!