Skip to content

Commit 576f704

Browse files
committedMay 30, 2021
Add -m/--maxdepth to specify levels of recursion. Fixes rbsec#32
1 parent 8e735d7 commit 576f704

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dnscan.py (-d \<domain\> | -l \<list\>) [OPTIONS]
2222
-6 --ipv6 Scan for IPv6 records (AAAA)
2323
-z --zonetransfer Perform zone transfer and exit
2424
-r --recursive Recursively scan subdomains
25+
-m --maxdepth Maximum levels to scan recursively
2526
-R --resolver <resolver> Use the specified resolver instead of the system default
2627
-T --tld Scan for the domain in all TLDs
2728
-o --output <filename> Output to a text file

‎dnscan.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ def get_name(self, domain):
9898
except NameError:
9999
addresses.add(ipaddr(str(address)))
100100

101-
if domain != target and args.recurse: # Don't scan root domain twice
101+
if ( domain != target and \
102+
args.recurse and \
103+
domain.count('.') - target.count('.') <= args.maxdepth
104+
):
102105
add_target(domain) # Recursively scan subdomains
103106
except:
104107
pass
@@ -317,6 +320,7 @@ def get_args():
317320
parser.add_argument('-6', '--ipv6', help='Scan for AAAA records', action="store_true", dest='ipv6', required=False, default=False)
318321
parser.add_argument('-z', '--zonetransfer', action="store_true", default=False, help='Only perform zone transfers', dest='zonetransfer', required=False)
319322
parser.add_argument('-r', '--recursive', action="store_true", default=False, help="Recursively scan subdomains", dest='recurse', required=False)
323+
parser.add_argument('-m', '--maxdepth', help='Maximal recursion depth (for brute-forcing)', dest='maxdepth', required=False, type=int, default=5)
320324
parser.add_argument('-R', '--resolver', help="Use the specified resolver instead of the system default", dest='resolver', required=False)
321325
parser.add_argument('-T', '--tld', action="store_true", default=False, help="Scan for TLDs", dest='tld', required=False)
322326
parser.add_argument('-o', '--output', help="Write output to a file", dest='output_filename', required=False)

0 commit comments

Comments
 (0)