Skip to content

Commit

Permalink
add stripdomain option
Browse files Browse the repository at this point in the history
  • Loading branch information
freb committed Feb 22, 2017
1 parent 7952dda commit 7d5dcb7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dns-brute2.nse
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ script may need to be adjusted.
-- @args dns-brute.maxresolvers Limit the number of resolvers to use from the
-- provided list. Number of supplied hosts times the
-- number of threads is the most efficient value.
-- @args dns-brute.stripdomain Strip subdomains from scanned domains so that children
-- of only the primary domain are found. E.g. scan
-- *.example.com when sub.example.com is provided, instead
-- of *.sub.example.com
-- @output
-- Pre-scan script results:
-- | dns-brute2:
Expand Down Expand Up @@ -178,7 +182,10 @@ local function guess_domain(host)

name = stdnse.get_hostname(host)
if name and name ~= host.ip then
return string.match(name, "%.([^.]+%..+)%.?$") or string.match(name, "^([^.]+%.[^.]+)%.?$")
if stdnse.get_script_args('dns-brute.stripdomain')
return string.match(name, "%.([^.]+%..+)%.?$") or string.match(name, "^([^.]+%.[^.]+)%.?$")
end
return name
else
return nil
end
Expand Down

0 comments on commit 7d5dcb7

Please sign in to comment.