1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 12:41:29 +00:00

Fix location of try/catch. The pcap/dnet variables were not in scope.

This commit is contained in:
batrick
2012-06-06 21:36:02 +00:00
parent a83ed012fd
commit 2dcb08a590
3 changed files with 18 additions and 18 deletions

View File

@@ -35,12 +35,6 @@ prerule = function()
return nmap.is_privileged() return nmap.is_privileged()
end end
catch = function()
dnet:ethernet_close()
pcap:pcap_close()
end
try = nmap.new_try(catch)
local function get_interfaces() local function get_interfaces()
local interface_name = stdnse.get_script_args(SCRIPT_NAME .. ".interface") local interface_name = stdnse.get_script_args(SCRIPT_NAME .. ".interface")
or nmap.get_interface() or nmap.get_interface()
@@ -92,6 +86,12 @@ local function single_interface_broadcast(if_nfo, results)
local dnet = nmap.new_dnet() local dnet = nmap.new_dnet()
local pcap = nmap.new_socket() local pcap = nmap.new_socket()
local function catch ()
dnet:ethernet_close()
pcap:pcap_close()
end
local try = nmap.new_try(catch)
try(dnet:ethernet_open(if_nfo.device)) try(dnet:ethernet_open(if_nfo.device))
pcap:pcap_open(if_nfo.device, 128, false, "icmp6 and ip6[6:1] = 58 and ip6[40:1] = 129") pcap:pcap_open(if_nfo.device, 128, false, "icmp6 and ip6[6:1] = 58 and ip6[40:1] = 129")

View File

@@ -37,12 +37,6 @@ prerule = function()
return nmap.is_privileged() return nmap.is_privileged()
end end
catch = function()
dnet:ethernet_close()
pcap:pcap_close()
end
try = nmap.new_try(catch)
--- Build an IPv6 invalid extension header. --- Build an IPv6 invalid extension header.
-- @param nxt_hdr integer that stands for next header's type -- @param nxt_hdr integer that stands for next header's type
local function build_invalid_extension_header(nxt_hdr) local function build_invalid_extension_header(nxt_hdr)
@@ -110,6 +104,12 @@ local function single_interface_broadcast(if_nfo, results)
local dnet = nmap.new_dnet() local dnet = nmap.new_dnet()
local pcap = nmap.new_socket() local pcap = nmap.new_socket()
local function catch ()
dnet:ethernet_close()
pcap:pcap_close()
end
local try = nmap.new_try(catch)
try(dnet:ethernet_open(if_nfo.device)) try(dnet:ethernet_open(if_nfo.device))
pcap:pcap_open(if_nfo.device, 128, false, "icmp6 and ip6[6:1] = 58 and ip6[40:1] = 4") pcap:pcap_open(if_nfo.device, 128, false, "icmp6 and ip6[6:1] = 58 and ip6[40:1] = 4")

View File

@@ -51,12 +51,6 @@ prerule = function()
return nmap.is_privileged() return nmap.is_privileged()
end end
catch = function()
dnet:ethernet_close()
pcap:pcap_close()
end
try = nmap.new_try(catch)
local function get_identifier(ip6_addr) local function get_identifier(ip6_addr)
return string.sub(ip6_addr, 9, 16) return string.sub(ip6_addr, 9, 16)
end end
@@ -152,6 +146,12 @@ local function single_interface_broadcast(if_nfo, results)
local dnet = nmap.new_dnet() local dnet = nmap.new_dnet()
local pcap = nmap.new_socket() local pcap = nmap.new_socket()
local function catch ()
dnet:ethernet_close()
pcap:pcap_close()
end
local try = nmap.new_try(catch)
try(dnet:ethernet_open(if_nfo.device)) try(dnet:ethernet_open(if_nfo.device))
pcap:pcap_open(if_nfo.device, 128, true, "src ::0/128 and dst net ff02::1:0:0/96 and icmp6 and ip6[6:1] = 58 and ip6[40:1] = 135") pcap:pcap_open(if_nfo.device, 128, true, "src ::0/128 and dst net ff02::1:0:0/96 and icmp6 and ip6[6:1] = 58 and ip6[40:1] = 135")