mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Reindent some scripts. Whitespace only.
https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
@@ -47,65 +47,65 @@ portrule = shortport.port_or_service ({443,8080}, "https", "tcp")
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
local result = {}
|
||||
local path = "/cgi-bin/authLogin.cgi"
|
||||
local config_file = ""
|
||||
local result = {}
|
||||
local path = "/cgi-bin/authLogin.cgi"
|
||||
local config_file = ""
|
||||
|
||||
-- Retrieve file
|
||||
stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
|
||||
local data = http.get(host, port, path)
|
||||
-- Retrieve file
|
||||
stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
|
||||
local data = http.get(host, port, path)
|
||||
|
||||
-- Check if file exists
|
||||
if data and data.status and data.status == 200 and data.body and data.body ~= "" then
|
||||
-- Check if file exists
|
||||
if data and data.status and data.status == 200 and data.body and data.body ~= "" then
|
||||
|
||||
-- Check if the config file is valid
|
||||
stdnse.print_debug(1, "%s: HTTP %s: %s", SCRIPT_NAME, data.status, path)
|
||||
if string.match(data.body, '<QDocRoot version="[^"]+">') then
|
||||
config_file = data.body
|
||||
else
|
||||
stdnse.print_debug(1, ("%s: %s:%s uses an invalid config file."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
|
||||
return
|
||||
end
|
||||
-- Check if the config file is valid
|
||||
stdnse.print_debug(1, "%s: HTTP %s: %s", SCRIPT_NAME, data.status, path)
|
||||
if string.match(data.body, '<QDocRoot version="[^"]+">') then
|
||||
config_file = data.body
|
||||
else
|
||||
stdnse.print_debug(1, ("%s: %s:%s uses an invalid config file."):format(SCRIPT_NAME, host.targetname or host.ip, port.number))
|
||||
return
|
||||
end
|
||||
|
||||
else
|
||||
stdnse.print_debug(1, "%s: Failed to retrieve file: %s", SCRIPT_NAME, path)
|
||||
return
|
||||
end
|
||||
else
|
||||
stdnse.print_debug(1, "%s: Failed to retrieve file: %s", SCRIPT_NAME, path)
|
||||
return
|
||||
end
|
||||
|
||||
-- Extract system info from config file
|
||||
stdnse.print_debug(1, "%s: Extracting system info from %s", SCRIPT_NAME, path)
|
||||
local vars = {
|
||||
-- Extract system info from config file
|
||||
stdnse.print_debug(1, "%s: Extracting system info from %s", SCRIPT_NAME, path)
|
||||
local vars = {
|
||||
|
||||
-- System details --
|
||||
--{"Hostname","hostname"},
|
||||
{"Device Model", "internalModelName"},
|
||||
{"Firmware Version","version"},
|
||||
{"Firmware Build","build"},
|
||||
-- System details --
|
||||
--{"Hostname","hostname"},
|
||||
{"Device Model", "internalModelName"},
|
||||
{"Firmware Version","version"},
|
||||
{"Firmware Build","build"},
|
||||
|
||||
-- SSL --
|
||||
{"Force SSL","forceSSL"},
|
||||
{"SSL Port","stunnelPort"},
|
||||
-- SSL --
|
||||
{"Force SSL","forceSSL"},
|
||||
{"SSL Port","stunnelPort"},
|
||||
|
||||
-- Services --
|
||||
{"WebFS Enabled","webFSEnabled"},
|
||||
{"Multimedia Station Enabled","QMultimediaEnabled"},
|
||||
{"Multimedia Station V2 Supported","MSV2Supported"},
|
||||
{"Multimedia Station V2 Web Enabled","MSV2WebEnabled"},
|
||||
{"Download Station Enabled","QDownloadEnabled"},
|
||||
{"Network Video Recorder Enabled","NVREnabled"},
|
||||
{"Web File Manager Enabled","WFM2"},
|
||||
{"QWeb Server Enabled","QWebEnabled"},
|
||||
{"QWeb Server Port","QWebPort"},
|
||||
{"Qweb Server SSL Enabled","QWebSSLEnabled"},
|
||||
{"Qweb Server SSL Port","QWebSSLPort"},
|
||||
-- Services --
|
||||
{"WebFS Enabled","webFSEnabled"},
|
||||
{"Multimedia Station Enabled","QMultimediaEnabled"},
|
||||
{"Multimedia Station V2 Supported","MSV2Supported"},
|
||||
{"Multimedia Station V2 Web Enabled","MSV2WebEnabled"},
|
||||
{"Download Station Enabled","QDownloadEnabled"},
|
||||
{"Network Video Recorder Enabled","NVREnabled"},
|
||||
{"Web File Manager Enabled","WFM2"},
|
||||
{"QWeb Server Enabled","QWebEnabled"},
|
||||
{"QWeb Server Port","QWebPort"},
|
||||
{"Qweb Server SSL Enabled","QWebSSLEnabled"},
|
||||
{"Qweb Server SSL Port","QWebSSLPort"},
|
||||
|
||||
}
|
||||
for _, var in ipairs(vars) do
|
||||
local var_match = string.match(config_file, string.format('<%s><!.CDATA.(.+)..></%s>', var[2], var[2]))
|
||||
if var_match then table.insert(result, string.format("%s: %s", var[1], var_match)) end
|
||||
end
|
||||
}
|
||||
for _, var in ipairs(vars) do
|
||||
local var_match = string.match(config_file, string.format('<%s><!.CDATA.(.+)..></%s>', var[2], var[2]))
|
||||
if var_match then table.insert(result, string.format("%s: %s", var[1], var_match)) end
|
||||
end
|
||||
|
||||
-- Return results
|
||||
return stdnse.format_output(true, result)
|
||||
-- Return results
|
||||
return stdnse.format_output(true, result)
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user