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

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

@@ -1,3 +1,10 @@
local _G = require "_G"
local mysql = require "mysql"
local nmap = require "nmap"
local shortport = require "shortport"
local stdnse = require "stdnse"
local table = require "table"
description = [[
Audits MySQL database server security configuration against parts of
the CIS MySQL v1.0.2 benchmark (the engine can be used for other MySQL
@@ -82,27 +89,26 @@ author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
require 'shortport'
require 'mysql'
portrule = shortport.port_or_service(3306, "mysql")
local TEMPLATE_NAME, ADMIN_ACCOUNTS = "", ""
local function loadAuditRulebase( filename )
local file, err = loadfile(filename)
local env = setmetatable({
test = function(t) table.insert(rules, t) end;
}, {__index = _G})
local file, err = loadfile(filename, "t", env)
local rules = {}
if ( not(file) ) then
return false, ("ERROR: Failed to load rulebase:\n%s"):format(err)
end
setfenv(file, setmetatable({
test = function(t) table.insert(rules, t) end;
}, {__index = _G}))
file()
TEMPLATE_NAME = getfenv(file)["TEMPLATE_NAME"]
TEMPLATE_NAME = env.TEMPLATE_NAME
ADMIN_ACCOUNTS = getfenv(file)["ADMIN_ACCOUNTS"]
return true, rules
end
@@ -173,4 +179,4 @@ action = function( host, port )
})
return stdnse.format_output(true, { results })
end
end