projectdiscovery / shuffledns

MassDNS wrapper written in go to enumerate valid subdomains using active bruteforce as well as resolve subdomains with wildcard filtering and easy input-output support.
https://projectdiscovery.io
GNU General Public License v3.0
1.3k stars 185 forks source link

miss the last resolver server #44

Closed okxiaochen closed 2 years ago

okxiaochen commented 4 years ago

at file pkg/wildcards/resolver.go,

serverIndex := atomic.LoadInt32(&w.serversIndex)
if w.serversIndex >= int32(len(w.servers)-1) {
    atomic.StoreInt32(&w.serversIndex, 0)
    serverIndex = 0
}
resolver := w.servers[serverIndex]

the condition w.serversIndex >= int32(len(w.servers)-1) maybe wrong? because it's never use the last index of the list it should be w.serversIndex >= int32(len(w.servers))

okxiaochen commented 4 years ago

i found that after change the program went wrong and i didn't know why. so i change to

serverIndex := atomic.LoadInt32(&w.serversIndex)
resolver := w.servers[serverIndex % int32(len(w.servers))]

and it's work

ehsandeep commented 3 years ago

thank you @okdanta for reporting this, this should be fixed with https://github.com/projectdiscovery/shuffledns/pull/70