1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Use args of the form dns-zone-transfer.domain instead of dnszonetransfer.domain

in dns-zone-transfer.nse. Keep the old forms as undocumented aliases.
This commit is contained in:
david
2010-09-29 18:57:07 +00:00
parent 82ec5be065
commit ae9c5d6922

View File

@@ -4,16 +4,16 @@ Requests a zone transfer (AXFR) from a DNS server.
The script sends an AXFR query to a DNS server. The domain to query is The script sends an AXFR query to a DNS server. The domain to query is
determined by examining the name given on the command line, the DNS determined by examining the name given on the command line, the DNS
server's hostname, or it can be specified with the server's hostname, or it can be specified with the
<code>dnszonetransfer.domain</code> script argument. If the query is <code>dns-zone-transfer.domain</code> script argument. If the query is
successful all domains and domain types are returned along with common successful all domains and domain types are returned along with common
type specific data (SOA/MX/NS/PTR/A). type specific data (SOA/MX/NS/PTR/A).
This script can run at different phases of an Nmap scan: This script can run at different phases of an Nmap scan:
* Script Pre-scanning: in this phase the script will run before any * Script Pre-scanning: in this phase the script will run before any
Nmap scan and use the defined DNS server in the arguments. The script Nmap scan and use the defined DNS server in the arguments. The script
arguments in this phase are: <code>dnszonetransfer.server</code> the arguments in this phase are: <code>dns-zone-transfer.server</code> the
DNS server to use, can be a hostname or an IP address and must be DNS server to use, can be a hostname or an IP address and must be
specified. The <code>dnszonetransfer.port</code> argument is optional specified. The <code>dns-zone-transfer.port</code> argument is optional
and can be used to specify the DNS server port. and can be used to specify the DNS server port.
* Script scanning: in this phase the script will run after the other * Script scanning: in this phase the script will run after the other
Nmap phases and against an Nmap discovered DNS server. If we don't Nmap phases and against an Nmap discovered DNS server. If we don't
@@ -26,10 +26,10 @@ Useful resources
]] ]]
--- ---
-- @args dnszonetransfer.domain Domain to transfer. -- @args dns-zone-transfer.domain Domain to transfer.
-- @args dnszonetransfer.server DNS server. If set, this argument will -- @args dns-zone-transfer.server DNS server. If set, this argument will
-- enable the script for the "Script Pre-scanning phase". -- enable the script for the "Script Pre-scanning phase".
-- @args dnszonetransfer.port DNS server port, this argument concerns -- @args dns-zone-transfer.port DNS server port, this argument concerns
-- the "Script Pre-scanning phase" and it's optional, the default -- the "Script Pre-scanning phase" and it's optional, the default
-- value is <code>53</code>. -- value is <code>53</code>.
-- @output -- @output
@@ -60,7 +60,7 @@ Useful resources
-- |_ foo.com. SOA ns2.foo.com. piou.foo.com. -- |_ foo.com. SOA ns2.foo.com. piou.foo.com.
-- @usage -- @usage
-- nmap --script dns-zone-transfer.nse \ -- nmap --script dns-zone-transfer.nse \
-- --script-args dnszonetransfer.domain=<domain> -- --script-args dns-zone-transfer.domain=<domain>
require('shortport') require('shortport')
require('strbuf') require('strbuf')
@@ -317,19 +317,18 @@ end
action = function(host, port) action = function(host, port)
local soc, status, data local soc, status, data
local dns_server, dns_port
local catch = function() soc:close() end local catch = function() soc:close() end
local try = nmap.new_try(catch) local try = nmap.new_try(catch)
local domain = nil
local args = nmap.registry.args local args = nmap.registry.args
if args.dnszonetransfer and args.dnszonetransfer.domain then local domain, dns_server, dns_port = stdnse.get_script_args(
domain = args.dnszonetransfer.domain {"dns-zone-transfer.domain", "dnszonetransfer.domain"},
elseif args['dnszonetransfer.domain'] then {"dns-zone-transfer.server", "dnszonetransfer.server"},
domain = args['dnszonetransfer.domain'] {"dns-zone-transfer.port", "dnszonetransfer.port"}
elseif args.domain then )
domain = args.domain if not dns_port then
dns_port = 53
end end
-- script running at the Script Pre-scanning phase. -- script running at the Script Pre-scanning phase.
@@ -340,19 +339,12 @@ action = function(host, port)
SCRIPT_NAME, SCRIPT_TYPE) SCRIPT_NAME, SCRIPT_TYPE)
return return
end end
if args['dnszonetransfer.server'] then if not dns_server then
dns_server = args['dnszonetransfer.server']
else
stdnse.print_debug(3, stdnse.print_debug(3,
"Skipping '%s' %s, 'dnszonetransfer.server' argument is missing.", "Skipping '%s' %s, 'dnszonetransfer.server' argument is missing.",
SCRIPT_NAME, SCRIPT_TYPE) SCRIPT_NAME, SCRIPT_TYPE)
return return
end end
if args['dnszonetransfer.port'] then
dns_port = args['dnszonetransfer.port']
else
dns_port = 53
end
-- script running at the Script Scan phase. -- script running at the Script Scan phase.
elseif SCRIPT_TYPE == "portrule" then elseif SCRIPT_TYPE == "portrule" then
if not domain then if not domain then