Skip to content

Commit 56a5c90

Browse files
committed
fixed variable nameserver
1 parent f40fb63 commit 56a5c90

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

enum_tools/utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import datetime
88
import re
99
from multiprocessing.dummy import Pool as ThreadPool
10+
from functools import partial
1011
try:
1112
import requests
1213
import dns
@@ -100,7 +101,7 @@ def get_url_batch(url_list, use_ssl=False, callback='', threads=5):
100101
# Clear the status message
101102
sys.stdout.write(' \r')
102103

103-
def dns_lookup(name, nameserver="8.8.8.8"):
104+
def dns_lookup(nameserver, name):
104105
"""
105106
This function performs the actual DNS lookup when called in a threadpool
106107
by the fast_dns_lookup function.
@@ -131,7 +132,13 @@ def fast_dns_lookup(names, nameserver, callback='', threads=5):
131132

132133
for batch in queue:
133134
pool = ThreadPool(threads)
134-
results = pool.map(dns_lookup, batch)
135+
136+
# Because pool.map takes only a single function arg, we need to
137+
# define this partial so that each iteration uses the same ns
138+
dns_lookup_params = partial(dns_lookup, nameserver)
139+
results = pool.map(dns_lookup_params, batch)
140+
141+
# We should now have the batch of results back, process them.
135142
for name in results:
136143
if name:
137144
if callback:

0 commit comments

Comments
 (0)