Lua 5.2 upgrade [1] for NSE.

[1] http://seclists.org/nmap-dev/2012/q2/34
This commit is contained in:
batrick 2012-05-27 08:53:32 +00:00
parent a839e69449
commit 000f6dc4d9
553 changed files with 13477 additions and 8870 deletions

View file

@ -14,15 +14,14 @@
-- new targets. If set to 0 or less then there
-- is no limit. The default value is 0.
local nmap = require "nmap"
local stdnse = require "stdnse"
local table = require "table"
local type = type
local select = select
local unpack = unpack
local tonumber = tonumber
local stdnse = require "stdnse"
local nmap = require "nmap"
module ("target")
_ENV = stdnse.module("target", stdnse.seeall)
-- This is a special variable and it is a global one, so
@ -69,7 +68,7 @@ end
-- local status, err = target.add("192.168.1.1")
-- local status, err = target.add("192.168.1.1","192.168.1.2",...)
-- local status, err = target.add("scanme.nmap.org","192.168.1.1",...)
-- local status, err = target.add(unpack(array_of_targets))
-- local status, err = target.add(table.unpack(array_of_targets))
-- local status, pending_targets = target.add()
-- @return True if it has been able to add a minimum one target, or
-- False on failures and if no targets were added. If this
@ -103,7 +102,7 @@ add = function (...)
return false, "Maximum new targets reached, no more new targets."
end
local hosts, err = nmap.add_targets(unpack(new_targets,1,new_targets.count))
local hosts, err = nmap.add_targets(table.unpack(new_targets,1,new_targets.count))
if hosts == 0 then
stdnse.print_debug(3, "%s", err)
@ -112,3 +111,5 @@ add = function (...)
return true, hosts
end
return _ENV;