From f18fce44871b74155822d0ae2db2992c3fd3bc53 Mon Sep 17 00:00:00 2001 From: Heino Sass Hallik Date: Thu, 14 Oct 2021 18:34:27 +0300 Subject: [PATCH] add dnsrecon plugin --- autorecon/default-plugins/dns.py | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/autorecon/default-plugins/dns.py b/autorecon/default-plugins/dns.py index 8793b3b..2326f3f 100644 --- a/autorecon/default-plugins/dns.py +++ b/autorecon/default-plugins/dns.py @@ -1,4 +1,6 @@ from autorecon.plugins import ServiceScan +from autorecon.io import error, info, fformat +from shutil import which class NmapDNS(ServiceScan): @@ -55,3 +57,56 @@ class NmapMulticastDNS(ServiceScan): async def run(self, service): await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(dns* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_multicastdns_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_multicastdns_nmap.xml" {address}') + + +class DnsReconDefault (ServiceScan): + def __init__(self): + super().__init__() + self.name = "DnsRecon Default Scan" + self.slug = 'dnsrecon' + self.priority = 0 + self.tags = ['default', 'safe', 'dns'] + + def configure(self): + self.match_service_name('^domain') + + def check(self): + tool = 'dnsrecon' + if which('gobuster') is None: + error('The program dnsrecon could not be found. Make sure it is installed. (On Kali, run: sudo apt install dnsrecon)') + + def manual(self, service, plugin_was_run): + service.add_manual_command('Use dnsrecon to automatically query data from the DNS server. You must specify the target domain name.', [ + 'dnsrecon -n {address} -d | tee {scandir}/{protocol}_{port}_dnsrecon_default_manual.txt' + ]) + + async def run(self, service): + if self.get_global('domain'): + await service.execute('dnsrecon -n {address} -d ' + self.get_global('domain'), outfile='{protocol}_{port}_dnsrecon_default.txt') + else: + await service.execute('echo "Domain name was not specified in the command line options. If you know the domain name, then look in the manual commands file for the dnsrecon command."', outfile='{scandir}/{protocol}_{port}_dnsrecon_default.txt') + +class DnsReconSubdomainBruteforce (ServiceScan): + def __init__(self): + super().__init__() + self.name = "DnsRecon Bruteforce Subdomains" + self.slug = 'dnsrecon-brute' + self.priority = 0 + self.tags = ['default', 'safe', 'long', 'dns'] + + def configure(self): + self.match_service_name('^domain') + + def check(self): + tool = 'dnsrecon' + if which('gobuster') is None: + error('The program dnsrecon could not be found. Make sure it is installed. (On Kali, run: sudo apt install dnsrecon)') + + def manual(self, service, plugin_was_run): + domain_name = '' + if self.get_global('domain'): + domain_name = self.get_global('domain') + service.add_manual_command('Use dnsrecon to bruteforce subdomains of a DNS domain.', [ + 'dnsrecon -n {address} -d ' + domain_name + ' -D /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -t brt | tee {scandir}/{protocol}_{port}_dnsrecon_subdomain_bruteforce.txt', + ]) +