1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 13:09:02 +00:00

Add checks for nmap.address_family == "inet" to scripts that require

that. Patch by Henri Doreau.
This commit is contained in:
david
2011-04-19 18:09:15 +00:00
parent 46c29d3f60
commit ec4db04494
6 changed files with 35 additions and 2 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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