Closed danieleperera closed 2 years ago
Please note the following example code is as simple as possible: runs single thread (which makes it slow for most applications) and provides no input validation and error checking.
import dnstwist
import queue
abused_tlds = [x.strip() for x in open('abused_tlds.txt').readlines()]
fuzz = dnstwist.DomainFuzz('google.com', tld_dictionary=abused_tlds)
fuzz.generate()
jobs = queue.Queue()
for j in fuzz.domains:
jobs.put(j)
worker = dnstwist.DomainThread(jobs)
worker.setDaemon(True)
worker.debug = True
worker.start()
worker.join()
domains = fuzz.permutations(registered=True)
print(dnstwist.create_json(domains))
Thanks. In this case do you suggest using subprocess?
process = subprocess.Popen([
'dnstwist',
'--debug',
'--registered',
'--format=json',
'--tld=./abused_tlds.dict',
'{}'.format(dns_monitored.domain_name),
],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout = process.communicate()[0]
Plus I'd also like to specify the dns server like 1.1.1.1 or 8.8.8.8. How can I also apply it? Thanks again!
Running it with subprocess
would be quick and dirty solution - do not recommend it.
Set up more threads and configure them with custom DNS resolvers like this:
worker.option_extdns = True
worker.nameservers = ['1.1.1.1', '8.8.8.8']
I'm relatively new to multiprocessing... How can I apply it to the example above? Or at least point me to the right direction? Thanks!
import dnstwist df['fuzz_count'] = 0
Please note the following example code is as simple as possible: runs single thread (which makes it slow for most applications) and provides no input validation and error checking.
import dnstwist import queue abused_tlds = [x.strip() for x in open('abused_tlds.txt').readlines()] fuzz = dnstwist.DomainFuzz('google.com', tld_dictionary=abused_tlds) fuzz.generate() jobs = queue.Queue() for j in fuzz.domains: jobs.put(j) worker = dnstwist.DomainThread(jobs) worker.setDaemon(True) worker.debug = True worker.start() worker.join() domains = fuzz.permutations(registered=True) print(dnstwist.create_json(domains))
With introduction of simple API and dnstwist.run()
, running the tool within another script should be pretty straightforward. Please refer to the README file.
Hi,
I'd like to run dnstwist inside another script with some additional parameters.
The above code works fine but how can I add the following parameters to the above code?
Thanks