Skip to content

Commit 7782a95

Browse files
fixes need to add extra argument to dnsbrute script close #91
1 parent fd6dece commit 7782a95

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

nmap3/nmap3.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def scan_command(self, target, arg, args=None, timeout=None):
123123
if (args):
124124
scancommand += " {0}".format(args)
125125

126-
127126
scan_shlex = shlex.split(scancommand)
128127
output = self.run_command(scan_shlex, timeout=timeout)
129128
file_name=re.search(r'(\-oX|-oN-|oG)\s+[a-zA-Z-_0-9]{1,100}\.[a-zA-Z]+',scancommand)
@@ -166,7 +165,7 @@ def scan_top_ports(self, target, default=10, args=None, timeout=None):
166165
self.top_ports = self.parser.filter_top_ports(xml_root)
167166
return self.top_ports
168167

169-
def nmap_dns_brute_script(self, target, dns_brute="--script dns-brute.nse", timeout=None):
168+
def nmap_dns_brute_script(self, target, dns_brute="--script dns-brute.nse", args=None, timeout=None):
170169
"""
171170
Perform nmap scan using the dns-brute script
172171
@@ -176,9 +175,11 @@ def nmap_dns_brute_script(self, target, dns_brute="--script dns-brute.nse", time
176175
nmap -oX - nmmapper.com --script dns-brute.nse
177176
"""
178177
self.target = target
179-
180178
dns_brute_args = "{target} {default}".format(target=target, default=dns_brute)
181-
179+
180+
if args:
181+
dns_brute_args += " {0}".format(args)
182+
182183
dns_brute_command = self.default_command() + dns_brute_args
183184
dns_brute_shlex = shlex.split(dns_brute_command) # prepare it for popen
184185

@@ -572,12 +573,15 @@ async def scan_top_ports(self, target, default=10, args=None, timeout=None):
572573
self.top_ports = self.parser.filter_top_ports(self.get_xml_et(output))
573574
return self.top_ports
574575

575-
async def nmap_dns_brute_script(self, target, dns_brute="--script dns-brute.nse", timeout=None):
576+
async def nmap_dns_brute_script(self, target, dns_brute="--script dns-brute.nse", args=None, timeout=None):
576577
self.target = target
577578

578579
dns_brute_args = "{target} {default}".format(target=target, default=dns_brute)
579580
dns_brute_command = self.default_command() + dns_brute_args
580-
581+
582+
if args:
583+
dns_brute_command += " {0}".format(args)
584+
581585
# Run the command and get the output
582586
output = await self.run_command(dns_brute_command, timeout=timeout)
583587
subdomains = self.parser.filter_subdomains(self.get_xml_et(output))

0 commit comments

Comments
 (0)