diff --git a/scripts/dhcp-discover.nse b/scripts/dhcp-discover.nse index 25f4b3623..ec640c8d2 100644 --- a/scripts/dhcp-discover.nse +++ b/scripts/dhcp-discover.nse @@ -67,7 +67,14 @@ require 'shortport' require 'stdnse' -- We want to run against a specific host if UDP/67 is open -portrule = shortport.portnumber(67, "udp") +function portrule(host, port) + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end + + return shortport.portnumber(67, "udp")(host, port) +end -- We will want to run as a prerule any time --prerule = function() diff --git a/scripts/firewalk.nse b/scripts/firewalk.nse index ddf359144..edca1b5c6 100644 --- a/scripts/firewalk.nse +++ b/scripts/firewalk.nse @@ -57,7 +57,9 @@ firewalk tool. -- --- 12/29/2010: initial version +-- 11/29/2010: initial version +-- 03/28/2011: added IPv4 check + author = "Henri Doreau" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" @@ -422,6 +424,11 @@ hostrule = function(host) return false end + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end + if not host.interface then return false end diff --git a/scripts/ipidseq.nse b/scripts/ipidseq.nse index c97272a1f..b79040564 100644 --- a/scripts/ipidseq.nse +++ b/scripts/ipidseq.nse @@ -30,6 +30,7 @@ categories = {"safe", "discovery"} require 'bin' require 'packet' +require 'nmap' require 'stdnse' local NUMPROBES = 6 @@ -198,6 +199,10 @@ hostrule = function(host) end return false end + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end if not host.interface then return false end diff --git a/scripts/path-mtu.nse b/scripts/path-mtu.nse index 8687010ad..db4a4cd9b 100644 --- a/scripts/path-mtu.nse +++ b/scripts/path-mtu.nse @@ -38,6 +38,7 @@ categories = {"safe", "discovery"} require 'bin' require 'packet' +require 'nmap' require 'stdnse' local IPPROTO_ICMP = packet.IPPROTO_ICMP @@ -279,6 +280,10 @@ hostrule = function(host) end return false end + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end if not (host.interface and host.interface_mtu) then return false end diff --git a/scripts/qscan.nse b/scripts/qscan.nse index 950e88d0f..a5272bf4c 100644 --- a/scripts/qscan.nse +++ b/scripts/qscan.nse @@ -53,6 +53,7 @@ require 'stdnse' require 'bin' require 'packet' require 'tab' +require 'nmap' -- defaults local DELAY = 0.200 @@ -378,6 +379,10 @@ hostrule = function(host) end return false end + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end if not host.interface then return false end diff --git a/scripts/sniffer-detect.nse b/scripts/sniffer-detect.nse index c97ac3d88..d3b336d1a 100644 --- a/scripts/sniffer-detect.nse +++ b/scripts/sniffer-detect.nse @@ -17,6 +17,10 @@ categories = {"discovery", "intrusive"} -- okay, we're interested only in hosts that are on our ethernet lan hostrule = function(host) + if nmap.address_family() ~= 'inet' then + stdnse.print_debug("%s is IPv4 compatible only.", SCRIPT_NAME) + return false + end return host.directly_connected == true and host.mac_addr ~= nil and host.mac_addr_src ~= nil and