mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Move string utility functions to stringaux.lua
This commit is contained in:
@@ -170,7 +170,7 @@ local function format_ipv4(ipv4)
|
||||
octets[#octets + 1] = string.format("%d", v)
|
||||
end
|
||||
|
||||
return stdnse.strjoin(".", octets)
|
||||
return table.concat(octets, ".")
|
||||
end
|
||||
|
||||
local function do_ipv4(addr)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local ajp = require "ajp"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tableaux = require "table"
|
||||
|
||||
@@ -66,14 +67,14 @@ action = function(host, port)
|
||||
return "Failed to get a valid response for the OPTION request"
|
||||
end
|
||||
|
||||
local methods = stdnse.strsplit(",%s", response.headers['allow'])
|
||||
local methods = stringaux.strsplit(",%s", response.headers['allow'])
|
||||
|
||||
local output = {}
|
||||
table.insert(output, ("Supported methods: %s"):format(stdnse.strjoin(" ", methods)))
|
||||
table.insert(output, ("Supported methods: %s"):format(table.concat(methods, " ")))
|
||||
|
||||
local interesting = filter_out(methods, UNINTERESTING_METHODS)
|
||||
if ( #interesting > 0 ) then
|
||||
table.insert(output, "Potentially risky methods: " .. stdnse.strjoin(" ", interesting))
|
||||
table.insert(output, "Potentially risky methods: " .. table.concat(interesting, " "))
|
||||
table.insert(output, "See https://nmap.org/nsedoc/scripts/ajp-methods.html")
|
||||
end
|
||||
return stdnse.format_output(true, output)
|
||||
|
||||
@@ -2,6 +2,7 @@ local ajp = require "ajp"
|
||||
local io = require "io"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Requests a URI over the Apache JServ Protocol and displays the result
|
||||
@@ -84,7 +85,7 @@ action = function(host, port)
|
||||
|
||||
if ( response ) then
|
||||
local output = response.status_line .. "\n" ..
|
||||
stdnse.strjoin("\n", response.rawheaders) ..
|
||||
table.concat(response.rawheaders, "\n") ..
|
||||
(response.body and "\n\n" .. response.body or "")
|
||||
if ( arg_file ) then
|
||||
local f = io.open(arg_file, "w")
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local tab = require "tab"
|
||||
local target = require "target"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Listens for the LAN sync information broadcasts that the Dropbox.com client
|
||||
@@ -113,9 +114,9 @@ action = function()
|
||||
info.displayname,
|
||||
ip,
|
||||
info.port,
|
||||
stdnse.strjoin(".", info.version),
|
||||
table.concat(info.version, "."),
|
||||
info.host_int,
|
||||
stdnse.strjoin(", ", info.namespaces)
|
||||
table.concat(info.namespaces, ", ")
|
||||
)
|
||||
|
||||
stdnse.debug1("Added host %s.", info.displayname)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local target = require "target"
|
||||
local os = require "os"
|
||||
local table = require "table"
|
||||
@@ -66,7 +67,7 @@ action = function()
|
||||
local hid_pkt = data:match("^discovered;.*$")
|
||||
if ( hid_pkt ) then
|
||||
local status, _, _, rhost, _ = socket:get_info()
|
||||
local hid_data = stdnse.strsplit(";", hid_pkt)
|
||||
local hid_data = stringaux.strsplit(";", hid_pkt)
|
||||
if #hid_data == 10 and hid_data[1] == 'discovered' and tonumber(hid_data[2]) == string.len(hid_pkt) then
|
||||
stdnse.print_debug(2, "Received HID discoveryd response from %s (%s bytes)", rhost, string.len(hid_pkt))
|
||||
local str = ("MAC: %s; Name: %s; IP Address: %s; Model: %s; Version: %s (%s)"):format(
|
||||
|
||||
@@ -6,6 +6,7 @@ local ipOps = require "ipOps"
|
||||
local target = require "target"
|
||||
local coroutine = require "coroutine"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local io = require "io"
|
||||
|
||||
description = [[
|
||||
@@ -276,7 +277,7 @@ local mgroup_names_fetch = function(filename)
|
||||
end
|
||||
|
||||
for l in file:lines() do
|
||||
groupnames_db[#groupnames_db + 1] = stdnse.strsplit("\t", l)
|
||||
groupnames_db[#groupnames_db + 1] = stringaux.strsplit("\t", l)
|
||||
end
|
||||
|
||||
file:close()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local ipOps = require "ipOps"
|
||||
local srvloc = require "srvloc"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -46,7 +47,7 @@ function action()
|
||||
attrib = attrib:match("^%(svcaddr%-ws=(.*)%)$")
|
||||
if ( not(attrib) ) then return end
|
||||
|
||||
local attribs = stdnse.strsplit(",", attrib)
|
||||
local attribs = stringaux.strsplit(",", attrib)
|
||||
if ( not(attribs) ) then return end
|
||||
|
||||
local addrs = { name = "Addresses"}
|
||||
|
||||
@@ -8,6 +8,7 @@ local unpwdb = require "unpwdb"
|
||||
local io = require "io"
|
||||
local table = require "table"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
|
||||
description = [[
|
||||
@@ -115,7 +116,7 @@ Driver = {
|
||||
local loop = 1
|
||||
local err, status
|
||||
stdnse.debug(2,"Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
self.tn3270:send_cursor(run[i])
|
||||
@@ -271,7 +272,7 @@ local function cics_test( host, port, commands, user, pass )
|
||||
end
|
||||
tn:get_screen_debug(2) -- prints TN3270 screen to debug
|
||||
stdnse.debug("Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
tn:send_cursor(run[i])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local shortport = require "shortport"
|
||||
local stringaux = require "stringaux"
|
||||
local tn3270 = require "tn3270"
|
||||
local table = require "table"
|
||||
|
||||
@@ -104,7 +105,7 @@ local function cics_info( host, port, commands, user, pass, cemt, trans )
|
||||
end
|
||||
tn:get_screen_debug(2) -- prints TN3270 screen to debug
|
||||
stdnse.debug("Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
tn:send_cursor(run[i])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local nmap = require "nmap"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local stdnse = require "stdnse"
|
||||
local shortport = require "shortport"
|
||||
local tn3270 = require "tn3270"
|
||||
@@ -83,7 +84,7 @@ Driver = {
|
||||
local loop = 1
|
||||
local err
|
||||
stdnse.debug(2,"Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(2,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
self.tn3270:send_cursor(run[i])
|
||||
@@ -201,7 +202,7 @@ local function cics_test( host, port, commands )
|
||||
end
|
||||
tn:get_screen_debug(2) -- prints TN3270 screen to debug
|
||||
stdnse.debug(2,"Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(2,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
tn:send_cursor(run[i])
|
||||
|
||||
@@ -5,6 +5,7 @@ local brute = require "brute"
|
||||
local creds = require "creds"
|
||||
local unpwdb = require "unpwdb"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
description = [[
|
||||
CICS User ID enumeration script for the CESL/CESN Login screen.
|
||||
@@ -79,7 +80,7 @@ Driver = {
|
||||
local loop = 1
|
||||
local err
|
||||
stdnse.debug(2,"Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
self.tn3270:send_cursor(run[i])
|
||||
@@ -165,7 +166,7 @@ local function cics_test( host, port, commands, transaction )
|
||||
end
|
||||
tn:get_screen_debug(2) -- prints TN3270 screen to debug
|
||||
stdnse.debug("Getting to CICS")
|
||||
local run = stdnse.strsplit(";%s*", commands)
|
||||
local run = stringaux.strsplit(";%s*", commands)
|
||||
for i = 1, #run do
|
||||
stdnse.debug(1,"Issuing Command (#%s of %s): %s", i, #run ,run[i])
|
||||
tn:send_cursor(run[i])
|
||||
|
||||
@@ -93,11 +93,11 @@ function format_output(appdata, mode)
|
||||
if AppData.AccessList then
|
||||
|
||||
if AppData.AccessList.User then
|
||||
line = line .. "; Users: " .. stdnse.strjoin(", ", AppData.AccessList.User)
|
||||
line = line .. "; Users: " .. table.concat(AppData.AccessList.User, ", ")
|
||||
end
|
||||
|
||||
if AppData.AccessList.Group then
|
||||
line = line .. "; Groups: " .. stdnse.strjoin(", ", AppData.AccessList.Group)
|
||||
line = line .. "; Groups: " .. table.concat(AppData.AccessList.Group, ", ")
|
||||
end
|
||||
|
||||
table.insert(result, line)
|
||||
@@ -123,11 +123,11 @@ function format_output(appdata, mode)
|
||||
|
||||
if AppData.AccessList then
|
||||
if AppData.AccessList.User then
|
||||
table.insert(result_part, "Users: " .. stdnse.strjoin(", ", AppData.AccessList.User) )
|
||||
table.insert(result_part, "Users: " .. table.concat(AppData.AccessList.User, ", ") )
|
||||
end
|
||||
|
||||
if AppData.AccessList.Group then
|
||||
table.insert(result_part, "Groups: " .. stdnse.strjoin(", ", AppData.AccessList.Group) )
|
||||
table.insert(result_part, "Groups: " .. table.concat(AppData.AccessList.Group, ", ") )
|
||||
end
|
||||
|
||||
table.insert(result, result_part)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local coap = require "coap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -163,7 +164,7 @@ get_blocks = function(helper, options, b2opt, payload, max_reqs)
|
||||
}
|
||||
}
|
||||
|
||||
local components = stdnse.strsplit("/", options.uri)
|
||||
local components = stringaux.strsplit("/", options.uri)
|
||||
for _, component in ipairs(components) do
|
||||
if component ~= "" then
|
||||
table.insert(opts.options, {["name"] = "uri_path", ["value"] = component})
|
||||
|
||||
@@ -103,7 +103,7 @@ local function go(host, port)
|
||||
-- Decide which type of request to make
|
||||
local request_type = dhcp.request_types[nmap.registry.args.dhcptype or "DHCPINFORM"]
|
||||
if(request_type == nil) then
|
||||
return false, "Valid request types: " .. stdnse.strjoin(", ", dhcp.request_types_str)
|
||||
return false, "Valid request types: " .. table.concat(dhcp.request_types_str, ", ")
|
||||
end
|
||||
|
||||
-- Generate the MAC address, if it's random
|
||||
|
||||
@@ -52,7 +52,7 @@ action = function(host, port)
|
||||
'quit',
|
||||
}
|
||||
|
||||
if ( not(socket:send(stdnse.strjoin("\r\n", probes) .. "\r\n")) ) then
|
||||
if ( not(socket:send(table.concat(probes, "\r\n") .. "\r\n")) ) then
|
||||
return fail("Failed to send request to server")
|
||||
end
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ local math = require "math"
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
local rand = require "rand"
|
||||
@@ -159,7 +160,7 @@ local function srv_main(domainname, srvresults, srv_iter)
|
||||
if(res) then
|
||||
for _,addr in ipairs(res) do
|
||||
local hostn = name..'.'..domainname
|
||||
addr = stdnse.strsplit(":",addr)
|
||||
addr = stringaux.strsplit(":",addr)
|
||||
for _, dtype in ipairs({"A", "AAAA"}) do
|
||||
local srvres = resolve(addr[4], dtype)
|
||||
if(srvres) then
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Performs DNS cache snooping against a DNS server.
|
||||
@@ -228,5 +229,5 @@ action = function(host, port)
|
||||
nmap.set_port_state(host, port, "open")
|
||||
end
|
||||
|
||||
return string.format("%d of %d tested domains are cached.\n", #cached, #domains) .. stdnse.strjoin("\n", cached)
|
||||
return string.format("%d of %d tested domains are cached.\n", #cached, #domains) .. table.concat(cached, "\n")
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ local dns_checks = {
|
||||
|
||||
local output = "None of the servers allow recursive queries."
|
||||
if ( 0 < #result ) then
|
||||
output = ("The following servers allow recursive queries: %s"):format(stdnse.strjoin(", ", result))
|
||||
output = ("The following servers allow recursive queries: %s"):format(table.concat(result, ", "))
|
||||
return true, { status = Status.FAIL, output = output }
|
||||
end
|
||||
return true, { status = Status.PASS, output = output }
|
||||
@@ -139,7 +139,7 @@ local dns_checks = {
|
||||
|
||||
local output = "All DNS IPs were public"
|
||||
if ( 0 < #result ) then
|
||||
output = ("The following private IPs were detected: %s"):format(stdnse.strjoin(", ", result))
|
||||
output = ("The following private IPs were detected: %s"):format(table.concat(result, ", "))
|
||||
status = Status.FAIL
|
||||
else
|
||||
status = Status.PASS
|
||||
@@ -167,7 +167,7 @@ local dns_checks = {
|
||||
|
||||
local output = "All servers respond to DNS queries"
|
||||
if ( 0 < #result ) then
|
||||
output = ("The following servers did not respond to DNS queries: %s"):format(stdnse.strjoin(", ", result))
|
||||
output = ("The following servers did not respond to DNS queries: %s"):format(table.concat(result, ", "))
|
||||
return true, { status = Status.FAIL, output = output }
|
||||
end
|
||||
return true, { status = Status.PASS, output = output }
|
||||
@@ -213,7 +213,7 @@ local dns_checks = {
|
||||
end
|
||||
|
||||
if ( 0 < #result ) then
|
||||
local output = ("The following servers were found in the zone, but not in the parent: %s"):format(stdnse.strjoin(", ", result))
|
||||
local output = ("The following servers were found in the zone, but not in the parent: %s"):format(table.concat(result, ", "))
|
||||
return true, { status = Status.FAIL, output = output }
|
||||
end
|
||||
|
||||
@@ -261,7 +261,7 @@ local dns_checks = {
|
||||
end
|
||||
|
||||
if ( 0 < #result ) then
|
||||
local output = ("The following servers were found in the parent, but not in the zone: %s"):format(stdnse.strjoin(", ", result))
|
||||
local output = ("The following servers were found in the parent, but not in the zone: %s"):format(table.concat(result, ", "))
|
||||
return true, { status = Status.FAIL, output = output }
|
||||
end
|
||||
|
||||
@@ -418,7 +418,7 @@ local dns_checks = {
|
||||
|
||||
local output = "All MX records have PTR records"
|
||||
if ( 0 < #result ) then
|
||||
output = ("The following IPs do not have PTR records: %s"):format(stdnse.strjoin(", ", result))
|
||||
output = ("The following IPs do not have PTR records: %s"):format(table.concat(result, ", "))
|
||||
return true, { status = Status.FAIL, output = output }
|
||||
end
|
||||
return true, { status = Status.PASS, output = output }
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tableaux = require "tableaux"
|
||||
|
||||
@@ -83,11 +84,11 @@ local function remove_empty(t)
|
||||
end
|
||||
|
||||
local function split(domain)
|
||||
return stdnse.strsplit("%.", domain)
|
||||
return stringaux.strsplit("%.", domain)
|
||||
end
|
||||
|
||||
local function join(components)
|
||||
return stdnse.strjoin(".", remove_empty(components))
|
||||
return table.concat(remove_empty(components, "."))
|
||||
end
|
||||
|
||||
-- Remove the first component of a domain name. Return nil if the number of
|
||||
|
||||
@@ -4,6 +4,7 @@ local dns = require "dns"
|
||||
local base32 = require "base32"
|
||||
local nmap = require "nmap"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tableaux = require "table"
|
||||
local rand = require "rand"
|
||||
@@ -103,11 +104,11 @@ local function remove_empty(t)
|
||||
end
|
||||
|
||||
local function split(domain)
|
||||
return stdnse.strsplit("%.", domain)
|
||||
return stringaux.strsplit("%.", domain)
|
||||
end
|
||||
|
||||
local function join(components)
|
||||
return stdnse.strjoin(".", remove_empty(components))
|
||||
return table.concat(remove_empty(components, "."))
|
||||
end
|
||||
|
||||
-- Remove the first component of a domain name. Return nil if the number of
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local dns = require "dns"
|
||||
local ipOps = require "ipOps"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
local table = require "table"
|
||||
|
||||
@@ -52,7 +53,7 @@ action = function(host)
|
||||
"Files Online", "Date added")
|
||||
for _, record in ipairs(result) do
|
||||
local name, ip, sbl, asn, country, status, level, files_online,
|
||||
dateadded = table.unpack(stdnse.strsplit("| ", record))
|
||||
dateadded = table.unpack(stringaux.strsplit("| ", record))
|
||||
level = levels[tonumber(level)] or "Unknown"
|
||||
tab.addrow(output, name, ip, sbl, asn, country, status, level, files_online, dateadded)
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local strbuf = require "strbuf"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
@@ -218,7 +219,7 @@ function build_domain(host)
|
||||
buf = strbuf.new()
|
||||
abs_name = {}
|
||||
|
||||
names = stdnse.strsplit('%.', host)
|
||||
names = stringaux.strsplit('%.', host)
|
||||
if names == nil then names = {host} end
|
||||
|
||||
-- try to determine root of domain name
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -75,7 +76,7 @@ local function readAPIBlock( socket )
|
||||
local status, line = socket:receive_lines(1)
|
||||
|
||||
if ( not(status) ) then return false, "Failed to read line" end
|
||||
lines = stdnse.strsplit( "\n", line )
|
||||
lines = stringaux.strsplit( "\n", line )
|
||||
|
||||
for _, line in ipairs( lines ) do
|
||||
if ( not(line:match("BeginData")) and not(line:match("EndData")) ) then
|
||||
@@ -110,7 +111,7 @@ action = function(host, port)
|
||||
if( not(user)) then return fail("No username supplied (see domcon-cmd.user)") end
|
||||
if( not(pass)) then return fail("No password supplied (see domcon-cmd.pass)") end
|
||||
|
||||
cmds = stdnse.strsplit(";%s*", cmd)
|
||||
cmds = stringaux.strsplit(";%s*", cmd)
|
||||
|
||||
socket:set_timeout(10000)
|
||||
local status = socket:connect( host, port )
|
||||
|
||||
@@ -2,6 +2,7 @@ local io = require "io"
|
||||
local nrpc = require "nrpc"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local unpwdb = require "unpwdb"
|
||||
|
||||
@@ -103,7 +104,7 @@ action = function(host, port)
|
||||
helper:disconnect()
|
||||
|
||||
if ( status and data and path ) then
|
||||
local filename = path .. "/" .. stdnse.filename_escape(username .. ".id")
|
||||
local filename = path .. "/" .. stringaux.filename_escape(username .. ".id")
|
||||
local status, err = saveIDFile( filename, data )
|
||||
|
||||
if ( status ) then
|
||||
|
||||
@@ -788,7 +788,7 @@ local function portrange(ports)
|
||||
end
|
||||
|
||||
-- ranges are delimited by `,'
|
||||
return stdnse.strjoin(",", strrange)
|
||||
return table.concat(strrange, ",")
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ local ftp = require "ftp"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local vulns = require "vulns"
|
||||
|
||||
description = [[
|
||||
@@ -74,7 +75,7 @@ end
|
||||
|
||||
-- Returns true if the provided version is vulnerable
|
||||
local function is_version_vulnerable(version)
|
||||
local vers = stdnse.strsplit("%.", version)
|
||||
local vers = stringaux.strsplit("%.", version)
|
||||
|
||||
if #vers > 0 and vers[3] then
|
||||
local relnum = string.sub(vers[3], 1, 1)
|
||||
|
||||
@@ -4,6 +4,7 @@ local match = require "match"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
local table = require "table"
|
||||
|
||||
@@ -91,7 +92,7 @@ local function decodeTag(tag, lines)
|
||||
tab.addrow(fs_tab, "Mount point", "Fs type", "Size", "Available")
|
||||
for _, line in ipairs(lines) do
|
||||
if ( ".clear" ~= line ) then
|
||||
local mount, prefix, fstype, size, free, used, bs = table.unpack(stdnse.strsplit("%s", line))
|
||||
local mount, prefix, fstype, size, free, used, bs = table.unpack(stringaux.strsplit("%s", line))
|
||||
if ( size and free and mount and fstype ) then
|
||||
size = ("%dM"):format(math.ceil(tonumber(size) * tonumber(bs) / 1048576))
|
||||
free = ("%dM"):format(math.ceil(tonumber(free) * tonumber(bs) / 1048576))
|
||||
@@ -116,7 +117,7 @@ local function decodeTag(tag, lines)
|
||||
elseif ( "uptime" == tag ) then
|
||||
return ("%s: %s"):format(long_names[tag], datetime.format_time(lines[1] * 60))
|
||||
elseif ( "mem" == tag ) then
|
||||
local total, used = table.unpack(stdnse.strsplit("%s", lines[1]))
|
||||
local total, used = table.unpack(stringaux.strsplit("%s", lines[1]))
|
||||
if ( not(total) or not(used) ) then
|
||||
return
|
||||
end
|
||||
@@ -124,7 +125,7 @@ local function decodeTag(tag, lines)
|
||||
total = math.ceil(tonumber(total)/1048576)
|
||||
return ("%s: Total %dM, Free %dM"):format(long_names[tag], total, free)
|
||||
elseif ( "proc" == tag ) then
|
||||
local procs, _, forks, load, users = table.unpack(stdnse.strsplit("%s", lines[1]))
|
||||
local procs, _, forks, load, users = table.unpack(stringaux.strsplit("%s", lines[1]))
|
||||
if ( not(procs) or not(forks) or not(load) or not(users) ) then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -70,7 +71,7 @@ action = function( host, port )
|
||||
while line ~= nil do
|
||||
if #line > 1 then
|
||||
local gtype = string.sub(line, 1, 1)
|
||||
local fields = stdnse.strsplit("\t", string.sub(line, 2))
|
||||
local fields = stringaux.strsplit("\t", string.sub(line, 2))
|
||||
if #fields > 1 then
|
||||
local label = fields[1]
|
||||
local filename = fields[2]
|
||||
@@ -86,6 +87,6 @@ action = function( host, port )
|
||||
end
|
||||
line = buffer()
|
||||
end
|
||||
return "\n" .. stdnse.strjoin("\n", files)
|
||||
return "\n" .. table.concat(files, "\n")
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ local math = require "math"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -51,7 +52,7 @@ action = function( host, port )
|
||||
return
|
||||
end
|
||||
local separator = string.sub(data, 1, 1)
|
||||
local fields = stdnse.strsplit(separator, data)
|
||||
local fields = stringaux.strsplit(separator, data)
|
||||
local info = {}
|
||||
local disks = math.floor((# fields) / 5)
|
||||
for i = 0, (disks - 1) do
|
||||
|
||||
@@ -3,6 +3,8 @@ local io = require "io"
|
||||
local ipOps = require "ipOps"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
|
||||
description = [[
|
||||
@@ -101,11 +103,11 @@ action = function(host)
|
||||
return nil
|
||||
end
|
||||
output_tab.hosts = hosts_log
|
||||
local hostnames_str = stdnse.strjoin("\n", hostnames)
|
||||
local hostnames_str = table.concat(hostnames, "\n")
|
||||
|
||||
local filename_prefix = stdnse.get_script_args("hostmap-bfk.prefix")
|
||||
if filename_prefix then
|
||||
local filename = filename_prefix .. stdnse.filename_escape(host.targetname or host.ip)
|
||||
local filename = filename_prefix .. stringaux.filename_escape(host.targetname or host.ip)
|
||||
local status, err = write_file(filename, hostnames_str .. "\n")
|
||||
if status then
|
||||
output_tab.filename = filename
|
||||
|
||||
@@ -48,6 +48,7 @@ local io = require "io"
|
||||
local http = require "http"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local target = require "target"
|
||||
local table = require "table"
|
||||
local tableaux = require "table"
|
||||
@@ -106,8 +107,8 @@ action = function(host)
|
||||
output_tab.subdomains = hostnames
|
||||
--write to file
|
||||
if filename_prefix then
|
||||
local filename = filename_prefix .. stdnse.filename_escape(get_hostname(host))
|
||||
hostnames_str = stdnse.strjoin("\n", hostnames)
|
||||
local filename = filename_prefix .. stringaux.filename_escape(get_hostname(host))
|
||||
hostnames_str = table.concat(hostnames, "\n")
|
||||
|
||||
local status, err = write_file(filename, hostnames_str)
|
||||
if status then
|
||||
|
||||
@@ -49,6 +49,8 @@ local io = require "io"
|
||||
local http = require "http"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
|
||||
local HOSTMAP_BING_SERVER = "www.ip2hosts.com"
|
||||
@@ -69,7 +71,7 @@ local function query_bing(ip)
|
||||
if not response.status then
|
||||
return string.format("Error: could not GET http://%s%s", HOSTMAP_BING_SERVER, query)
|
||||
end
|
||||
entries = stdnse.strsplit(",", response.body);
|
||||
entries = stringaux.strsplit(",", response.body);
|
||||
for _, entry in pairs(entries) do
|
||||
if not hostnames[entry] and entry ~= "" then
|
||||
if target.ALLOW_NEW_TARGETS then
|
||||
@@ -100,8 +102,8 @@ action = function(host)
|
||||
output_tab.hosts = hostnames
|
||||
--write to file
|
||||
if filename_prefix then
|
||||
local filename = filename_prefix .. stdnse.filename_escape(host.targetname or host.ip)
|
||||
hostnames_str = stdnse.strjoin("\n", hostnames)
|
||||
local filename = filename_prefix .. stringaux.filename_escape(host.targetname or host.ip)
|
||||
hostnames_str = table.concat(hostnames, "\n")
|
||||
local status, err = write_file(filename, hostnames_str)
|
||||
if status then
|
||||
output_tab.filename = filename
|
||||
|
||||
@@ -97,7 +97,7 @@ action = function(host, port)
|
||||
table.insert(schemes, item.scheme)
|
||||
end
|
||||
end
|
||||
tab.addrow(auth_urls, r.url, ("HTTP: %s"):format(stdnse.strjoin(", ", schemes)))
|
||||
tab.addrow(auth_urls, r.url, ("HTTP: %s"):format(table.concat(schemes, ", ")))
|
||||
else
|
||||
tab.addrow(auth_urls, r.url, ("HTTP: %s"):format(auth))
|
||||
end
|
||||
|
||||
@@ -131,6 +131,6 @@ action = function(host, port)
|
||||
|
||||
--output
|
||||
if #output>0 then
|
||||
return stdnse.strjoin("\n", output)
|
||||
return table.concat(output, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -192,6 +192,6 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if #output > 0 then
|
||||
return stdnse.strjoin("\n", output)
|
||||
return table.concat(output, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,6 +34,7 @@ local http = require "http"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local table = require "table"
|
||||
|
||||
local openssl = stdnse.silent_require "openssl"
|
||||
|
||||
@@ -96,17 +97,17 @@ action = function(host, port)
|
||||
-- Prepare output
|
||||
output_lines = {}
|
||||
if installation_version then
|
||||
output_lines[#output_lines + 1] = "Version of codebase: " .. stdnse.strjoin(", ", installation_version)
|
||||
output_lines[#output_lines + 1] = "Version of codebase: " .. table.concat(installation_version, ", ")
|
||||
end
|
||||
if icon_versions then
|
||||
output_lines[#output_lines + 1] = "Version of icons: " .. stdnse.strjoin(", ", icon_versions)
|
||||
output_lines[#output_lines + 1] = "Version of icons: " .. table.concat(icon_versions, ", ")
|
||||
end
|
||||
if stylesheet_versions then
|
||||
output_lines[#output_lines + 1] = "Version of stylesheet: " .. stdnse.strjoin(", ", stylesheet_versions)
|
||||
output_lines[#output_lines + 1] = "Version of stylesheet: " .. table.concat(stylesheet_versions, ", ")
|
||||
elseif stylesheet_hash and nmap.verbosity() >= 2 then
|
||||
output_lines[#output_lines + 1] = "Default stylesheet has an unknown hash: " .. stylesheet_hash
|
||||
end
|
||||
if #output_lines > 0 then
|
||||
return stdnse.strjoin("\n", output_lines)
|
||||
return table.concat(output_lines, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ local http = require "http"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -48,7 +49,7 @@ local function origin_ok(raw, origin)
|
||||
if raw == "null" then
|
||||
return false
|
||||
end
|
||||
local allowed = stdnse.strsplit(" ", raw)
|
||||
local allowed = stringaux.strsplit(" ", raw)
|
||||
for _, ao in ipairs(allowed) do
|
||||
if origin == ao then
|
||||
return true
|
||||
@@ -61,9 +62,9 @@ local function method_ok(raw, method)
|
||||
if not raw then
|
||||
return false
|
||||
end
|
||||
local stuff = stdnse.strsplit(" ", raw)
|
||||
local nospace = stdnse.strjoin("", stuff)
|
||||
local allowed = stdnse.strsplit(",", nospace)
|
||||
local stuff = stringaux.strsplit(" ", raw)
|
||||
local nospace = table.concat(stuff, "")
|
||||
local allowed = stringaux.strsplit(",", nospace)
|
||||
for _, am in ipairs(allowed) do
|
||||
if method == am then
|
||||
return true
|
||||
@@ -95,6 +96,6 @@ action = function(host, port)
|
||||
end
|
||||
end
|
||||
if #allowed > 0 then
|
||||
return stdnse.strjoin(" ", allowed)
|
||||
return table.concat(allowed, " ")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -291,13 +291,13 @@ Forgery attacks, and may allow third parties to access sensitive data meant for
|
||||
tostring(content[i])
|
||||
end
|
||||
vuln.check_results = content
|
||||
vuln.extra_info = string.format("Trusted domains:%s\n", stdnse.strjoin(', ', domains))
|
||||
vuln.extra_info = string.format("Trusted domains:%s\n", table.concat(domains, ', '))
|
||||
if not(lookup) and nmap.verbosity()>=2 then
|
||||
vuln.extra_info = vuln.extra_info .. "Use the script argument 'domain-lookup' to find trusted domains available for purchase"
|
||||
end
|
||||
if lookup ~= nil and #domains_available>0 then
|
||||
vuln.state = vulns.STATE.EXPLOIT
|
||||
vuln.extra_info = vuln.extra_info .. string.format("[!]Trusted domains available for purchase:%s", stdnse.strjoin(', ', domains_available))
|
||||
vuln.extra_info = vuln.extra_info .. string.format("[!]Trusted domains available for purchase:%s", table.concat(domains_available, ', '))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ local io = require "io"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -184,7 +185,7 @@ local function getUserDetails( body )
|
||||
-- Remove the parenthesis around the password
|
||||
http_passwd = http_passwd:sub(2,-2)
|
||||
-- In case we have more than one full name, return only the last
|
||||
full_name = stdnse.strsplit(";%s*", full_name)
|
||||
full_name = stringaux.strsplit(";%s*", full_name)
|
||||
full_name = full_name[#full_name]
|
||||
|
||||
return { fullname = full_name, passwd = ( http_passwd or dsp_http_passwd ), idfile = id_file }
|
||||
@@ -309,7 +310,7 @@ action = function(host, port)
|
||||
http_response = http.get( vhost or host, port, u_details.idfile, { auth = { username = user, password = pass }, no_cache = true })
|
||||
|
||||
if ( http_response.status == 200 ) then
|
||||
local filename = download_path .. "/" .. stdnse.filename_escape(u_details.fullname .. ".id")
|
||||
local filename = download_path .. "/" .. stringaux.filename_escape(u_details.fullname .. ".id")
|
||||
local status, err = saveIDFile( filename, http_response.body )
|
||||
if ( status ) then
|
||||
table.insert( id_files, ("%s ID File has been downloaded (%s)"):format(u_details.fullname, filename) )
|
||||
|
||||
@@ -6,6 +6,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[The script is used to fetch files from servers.
|
||||
@@ -99,7 +100,7 @@ local function save_file(content, file_name, destination, url)
|
||||
if url:getDir() == url:getFile() then
|
||||
file_path = file_path .. "index.html"
|
||||
else
|
||||
file_path = file_path .. stdnse.filename_escape(url:getFile():gsub(url:getDir(),""))
|
||||
file_path = file_path .. stringaux.filename_escape(url:getFile():gsub(url:getDir(),""))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ local http = require "http"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
description = [[
|
||||
Displays the contents of the "generator" meta tag of a web page (default: /)
|
||||
@@ -54,14 +55,7 @@ action = function(host, port)
|
||||
local redirects = tonumber(stdnse.get_script_args('http-generator.redirects')) or 3
|
||||
|
||||
-- Worst case: <meta name=Generator content="Microsoft Word 11">
|
||||
local pattern = '<meta name=[\"\']?generator[\"\']? content=[\"\']([^\"\']*)[\"\'] ?/?>'
|
||||
|
||||
-- Make pattern case-insensitive
|
||||
pattern = pattern:gsub("%a", function (c)
|
||||
return string.format("[%s%s]", string.lower(c),
|
||||
string.upper(c))
|
||||
end)
|
||||
|
||||
local pattern = stringaux.ipattern('<meta name=[\"\']?generator[\"\']? content=[\"\']([^\"\']*)[\"\'] ?/?>')
|
||||
response = http.get(host, port, path, {redirect_ok=redirects})
|
||||
if ( response and response.body ) then
|
||||
return response.body:match(pattern)
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Checks if hosts are on Google's blacklist of suspected malware and phishing
|
||||
@@ -103,6 +104,6 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if #output_lns > 0 then
|
||||
return stdnse.strjoin("\n", output_lns)
|
||||
return table.concat(output_lns, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Checks for a vulnerability in IIS 5.1/6.0 that allows arbitrary users to access
|
||||
@@ -211,7 +212,7 @@ action = function(host, port)
|
||||
return nmap.verbosity() > 0 and "WebDAV is ENABLED. No protected folder found; check not run. If you know a protected folder, add --script-args=webdavfolder=<path>" or nil
|
||||
end
|
||||
else
|
||||
return "WebDAV is ENABLED. Vulnerable folders discovered: " .. stdnse.strjoin(", ", results)
|
||||
return "WebDAV is ENABLED. Vulnerable folders discovered: " .. table.concat(results, ", ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Exploits a null-byte poisoning vulnerability in Litespeed Web Servers 4.0.x
|
||||
@@ -69,6 +70,6 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if #output>0 then
|
||||
return stdnse.strjoin("\n", output)
|
||||
return table.concat(output, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local io = require "io"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Exploits a directory traversal vulnerability existing in Majordomo2 to retrieve remote files. (CVE-2011-0049).
|
||||
@@ -90,6 +91,6 @@ action = function(host, port)
|
||||
output_lines[#output_lines+1] = string.format("Error saving %s to %s: %s\n", rfile, filewrite, err)
|
||||
end
|
||||
end
|
||||
return stdnse.strjoin("\n", output_lines)
|
||||
return table.concat(output_lines, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tableaux = require "table"
|
||||
local rand = require "rand"
|
||||
@@ -97,7 +98,7 @@ local function merge_headers(headers, names)
|
||||
for _, name in ipairs(names) do
|
||||
name = string.lower(name)
|
||||
if headers[name] then
|
||||
for _, v in ipairs(stdnse.strsplit(",%s*", headers[name])) do
|
||||
for _, v in ipairs(stringaux.strsplit(",%s*", headers[name])) do
|
||||
if not seen[v] then
|
||||
result[#result + 1] = v
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
local openssl = stdnse.silent_require "openssl"
|
||||
|
||||
@@ -146,12 +147,12 @@ action = function(host, port)
|
||||
|
||||
lines = {}
|
||||
if logo_versions then
|
||||
lines[#lines + 1] = "Versions from logo query (less accurate): " .. stdnse.strjoin(", ", logo_versions)
|
||||
lines[#lines + 1] = "Versions from logo query (less accurate): " .. table.concat(logo_versions, ", ")
|
||||
elseif logo_hash and nmap.verbosity() >= 2 then
|
||||
lines[#lines + 1] = "Logo query returned unknown hash " .. logo_hash
|
||||
end
|
||||
if credits_versions then
|
||||
lines[#lines + 1] = "Versions from credits query (more accurate): " .. stdnse.strjoin(", ", credits_versions)
|
||||
lines[#lines + 1] = "Versions from credits query (more accurate): " .. table.concat(credits_versions, ", ")
|
||||
elseif credits_hash and nmap.verbosity() >= 2 then
|
||||
lines[#lines + 1] = "Credits query returned unknown hash " .. credits_hash
|
||||
end
|
||||
@@ -160,6 +161,6 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if #lines > 0 then
|
||||
return stdnse.strjoin("\n", lines)
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ local http = require "http"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Sends an HTTP TRACE request and shows if the method TRACE is enabled. If debug
|
||||
@@ -53,7 +54,7 @@ local validate = function(response, response_headers)
|
||||
end
|
||||
end
|
||||
if #output_lines > 0 then
|
||||
return stdnse.strjoin("\n", output_lines)
|
||||
return table.concat(output_lines, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
Enumerates usernames in Wordpress blog/CMS installations by exploiting an
|
||||
@@ -133,7 +134,7 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if filewrite and #users>0 then
|
||||
local status, err = write_file(filewrite, stdnse.strjoin("\n", users))
|
||||
local status, err = write_file(filewrite, table.concat(users, "\n"))
|
||||
if status then
|
||||
output[#output+1] = string.format("Users saved to %s\n", filewrite)
|
||||
else
|
||||
@@ -143,6 +144,6 @@ action = function(host, port)
|
||||
|
||||
if #output > 1 then
|
||||
output[#output+1] = string.format("Search stopped at ID #%s. Increase the upper limit if necessary with 'http-wordpress-users.limit'", limit)
|
||||
return stdnse.strjoin("\n", output)
|
||||
return table.concat(output, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local match = require "match"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -49,7 +50,7 @@ local function parseResponse(resp)
|
||||
end
|
||||
|
||||
local resp_p = { header = {}, rawheader = {} }
|
||||
local resp_tbl = stdnse.strsplit("\r?\n", resp)
|
||||
local resp_tbl = stringaux.strsplit("\r?\n", resp)
|
||||
|
||||
if ( not(resp_tbl) or #resp_tbl == 0 ) then
|
||||
stdnse.debug2("Received an invalid response from server")
|
||||
@@ -91,7 +92,7 @@ action = function(host, port)
|
||||
return fail("Failed to connect to server")
|
||||
end
|
||||
|
||||
local request = (stdnse.strjoin("\r\n", probe) .. "\r\n\r\n"):format(hostname, service, hostname)
|
||||
local request = (table.concat(probe, "\r\n") .. "\r\n\r\n"):format(hostname, service, hostname)
|
||||
|
||||
if ( not(socket:send(request)) ) then
|
||||
socket:close()
|
||||
|
||||
@@ -43,7 +43,7 @@ action = function(host, port)
|
||||
for cap, args in pairs(capa) do
|
||||
table.insert(capstrings, cap)
|
||||
end
|
||||
return stdnse.strjoin(" ", capstrings)
|
||||
return table.concat(capstrings, " ")
|
||||
elseif type(capa) == "string" then
|
||||
stdnse.debug1("'%s' for %s", capa, host.ip)
|
||||
return
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local packet = require "packet"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
local rand = require "rand"
|
||||
|
||||
description = [[
|
||||
@@ -153,7 +154,7 @@ end
|
||||
|
||||
local commasep = {
|
||||
__tostring = function (t)
|
||||
return stdnse.strjoin(", ", t)
|
||||
return table.concat(t, ", ")
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ local function irc_compose_message(prefix, command, ...)
|
||||
end
|
||||
end
|
||||
|
||||
return stdnse.strjoin(" ", parts) .. "\r\n"
|
||||
return table.concat(parts, " ") .. "\r\n"
|
||||
end
|
||||
|
||||
local function splitlines(s)
|
||||
@@ -257,7 +257,7 @@ local function concat_channel_list(channels)
|
||||
mod[#mod + 1] = channel
|
||||
end
|
||||
|
||||
return stdnse.strjoin(",", mod)
|
||||
return table.concat(mod, ",")
|
||||
end
|
||||
|
||||
function action(host, port)
|
||||
@@ -308,7 +308,7 @@ function action(host, port)
|
||||
irc_disconnect(irc)
|
||||
|
||||
if errorparams then
|
||||
channels[#channels + 1] = "ERROR: " .. stdnse.strjoin(" ", errorparams)
|
||||
channels[#channels + 1] = "ERROR: " .. table.concat(errorparams, " ")
|
||||
end
|
||||
|
||||
return stdnse.format_output(true, channels)
|
||||
|
||||
@@ -280,7 +280,7 @@ function action(host,port)
|
||||
result_part.name = result_part.name .. ("; QFilter: %s"):format(qfilter)
|
||||
end
|
||||
if ( attribs ) then
|
||||
result_part.name = result_part.name .. ("; Attributes: %s"):format(stdnse.strjoin(",", attribs))
|
||||
result_part.name = result_part.name .. ("; Attributes: %s"):format(table.concat(attribs, ","))
|
||||
end
|
||||
|
||||
table.insert( result, result_part )
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
local table = require "table"
|
||||
|
||||
@@ -101,7 +102,7 @@ end
|
||||
local function parseVersion(data)
|
||||
local version_info = {}
|
||||
if ( #data > 27 ) then
|
||||
for _, line in ipairs(stdnse.strsplit("\n", data:sub(28))) do
|
||||
for _, line in ipairs(stringaux.strsplit("\n", data:sub(28))) do
|
||||
local key, val = line:match("^(%S+)%s-=%s(.*)%s*$")
|
||||
if ( key ) then version_info[key] = val end
|
||||
end
|
||||
@@ -115,7 +116,7 @@ end
|
||||
local function parseDatabases(data)
|
||||
local result = tab.new(5)
|
||||
tab.addrow(result, "instance", "path", "version", "kernel", "state")
|
||||
for _, line in ipairs(stdnse.strsplit("\n", data:sub(28))) do
|
||||
for _, line in ipairs(stringaux.strsplit("\n", data:sub(28))) do
|
||||
local cols = {}
|
||||
cols.instance, cols.path, cols.ver, cols.kernel,
|
||||
cols.state = line:match("^(.-)%s*\t(.-)%s*\t(.-)%s*\t(.-)%s-\t(.-)%s-$")
|
||||
|
||||
@@ -3,6 +3,7 @@ local http = require "http"
|
||||
local json = require "json"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local table = require "table"
|
||||
local tab = require "tab"
|
||||
|
||||
description = [[
|
||||
@@ -112,7 +113,7 @@ local function cmdReq(host, port, url, result)
|
||||
|
||||
if ( val ) then
|
||||
local name = filter[item].name
|
||||
val = ( "table" == type(val) and stdnse.strjoin(",", val) or val )
|
||||
val = ( "table" == type(val) and table.concat(val, ",") or val )
|
||||
result[item] = { name = name, value = val }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ local io = require "io"
|
||||
local mssql = require "mssql"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -123,7 +124,7 @@ action = function( host, port )
|
||||
local filename
|
||||
if ( dir ) then
|
||||
local instance = instance:GetName():match("%\\+(.+)$") or instance:GetName()
|
||||
filename = dir .. "/" .. stdnse.filename_escape(("%s_%s_ms-sql_hashes.txt"):format(host.ip, instance))
|
||||
filename = dir .. "/" .. stringaux.filename_escape(("%s_%s_ms-sql_hashes.txt"):format(host.ip, instance))
|
||||
saveToFile(filename, instanceOutput[1])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,7 +102,7 @@ local function process_instance( instance )
|
||||
|
||||
|
||||
"INSERT INTO #hasaccess EXEC sp_MShasdbaccess",
|
||||
("SELECT %s dbname, owner FROM #hasaccess WHERE dbname NOT IN(%s)"):format(limit, stdnse.strjoin(",", exclude_dbs)),
|
||||
("SELECT %s dbname, owner FROM #hasaccess WHERE dbname NOT IN(%s)"):format(limit, table.concat(exclude_dbs, ",")),
|
||||
"DROP TABLE #hasaccess" }
|
||||
|
||||
local creds = mssql.Helper.GetLoginCredentials_All( instance )
|
||||
|
||||
@@ -143,12 +143,12 @@ local function process_instance( instance )
|
||||
end
|
||||
|
||||
keywords_filter = (" AND ( so.name IN (%s) or sc.name IN (%s) ) "):format(
|
||||
stdnse.strjoin(",", tmp_tbl),
|
||||
stdnse.strjoin(",", tmp_tbl)
|
||||
table.concat(tmp_tbl, ","),
|
||||
table.concat(tmp_tbl, ",")
|
||||
)
|
||||
end
|
||||
|
||||
db_query = ("SELECT %s name from master..sysdatabases WHERE name NOT IN (%s)"):format(db_limit, stdnse.strjoin(",", exclude_dbs))
|
||||
db_query = ("SELECT %s name from master..sysdatabases WHERE name NOT IN (%s)"):format(db_limit, table.concat(exclude_dbs, ","))
|
||||
|
||||
|
||||
local creds = mssql.Helper.GetLoginCredentials_All( instance )
|
||||
@@ -210,7 +210,7 @@ local function process_instance( instance )
|
||||
if keywords_arg then
|
||||
local tmp = keywords_arg
|
||||
if ( type(tmp) == 'table' ) then
|
||||
tmp = stdnse.strjoin(',', tmp)
|
||||
tmp = table.concat(tmp, ',')
|
||||
end
|
||||
table.insert(restrict_tbl, 1, ("Filter: %s"):format(tmp))
|
||||
pos = pos + 1
|
||||
|
||||
@@ -177,7 +177,7 @@ action = function( host, port )
|
||||
|
||||
table.insert(results, "")
|
||||
table.insert(results, {name = "Additional information", ("The audit was performed using the db-account: %s"):format(username),
|
||||
("The following admin accounts were excluded from the audit: %s"):format(stdnse.strjoin(",", ADMIN_ACCOUNTS))
|
||||
("The following admin accounts were excluded from the audit: %s"):format(table.concat(ADMIN_ACCOUNTS, ","))
|
||||
})
|
||||
|
||||
return stdnse.format_output(true, { results })
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -93,7 +94,7 @@ local function format_acl(acl)
|
||||
return nil
|
||||
end
|
||||
local payload = string.sub(acl, 9) --skip header
|
||||
local fields = stdnse.strsplit("|", payload)
|
||||
local fields = stringaux.strsplit("|", payload)
|
||||
table.remove(fields, (# fields))
|
||||
return fields
|
||||
end
|
||||
@@ -103,7 +104,7 @@ local function format_apps(apps)
|
||||
return nil
|
||||
end
|
||||
local payload = string.sub(apps, 10) --skip header
|
||||
local fields = stdnse.strsplit("|", payload)
|
||||
local fields = stringaux.strsplit("|", payload)
|
||||
table.remove(fields, (# fields))
|
||||
return fields
|
||||
end
|
||||
@@ -113,7 +114,7 @@ local function format_info(info)
|
||||
return nil
|
||||
end
|
||||
local payload = string.sub(info, 6) --skip header
|
||||
local fields = stdnse.strsplit("|", payload)
|
||||
local fields = stringaux.strsplit("|", payload)
|
||||
return fields
|
||||
end
|
||||
|
||||
@@ -121,7 +122,7 @@ local function format_setup(setup)
|
||||
if setup == nil then
|
||||
return nil
|
||||
end
|
||||
local fields = stdnse.strsplit(";", setup)
|
||||
local fields = stringaux.strsplit(";", setup)
|
||||
if # fields < 7 then
|
||||
return nil
|
||||
end
|
||||
@@ -139,7 +140,7 @@ local function format_volume(volume)
|
||||
if volume == nil then
|
||||
return nil
|
||||
end
|
||||
local fields = stdnse.strsplit(";", volume)
|
||||
local fields = stringaux.strsplit(";", volume)
|
||||
if # fields < 4 then
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -88,7 +88,7 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
for _, v in ipairs( mounts ) do
|
||||
local entry = v.name .. " " .. stdnse.strjoin(" ", v)
|
||||
local entry = v.name .. " " .. table.concat(v, " ")
|
||||
table.insert( result, entry )
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local io = require "io"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
@@ -147,7 +148,7 @@ end
|
||||
|
||||
action = function( host, port )
|
||||
-- Oftentimes the LPAR will be one of the subdomain of a system.
|
||||
local names = host.name and stdnse.strsplit("%.", host.name) or {}
|
||||
local names = host.name and stringaux.strsplit("%.", host.name) or {}
|
||||
local o_host = stdnse.get_script_args('nje-node-brute.ohost') or nil
|
||||
local options = {}
|
||||
if o_host then options = { ohost = o_host:upper() } end
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
|
||||
-- -*- mode: lua -*-
|
||||
@@ -195,7 +196,7 @@ action = function(host, port)
|
||||
-- Get script arguments.
|
||||
local cmds = stdnse.get_script_args("nrpe-enum.cmds")
|
||||
if cmds then
|
||||
cmds = stdnse.strsplit(":", cmds)
|
||||
cmds = stringaux.strsplit(":", cmds)
|
||||
else
|
||||
cmds = NRPE_COMMANDS
|
||||
end
|
||||
|
||||
@@ -115,7 +115,7 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if target.ALLOW_NEW_TARGETS and targets ~= nil then
|
||||
stdnse.debug1("adding new targets %s", stdnse.strjoin(", ", targets))
|
||||
stdnse.debug1("adding new targets %s", table.concat(targets, ", "))
|
||||
target.add(table.unpack(targets))
|
||||
end
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -44,7 +45,7 @@ portrule = shortport.version_port_or_service(5850, "openlookup")
|
||||
|
||||
-- parses a Netstring element
|
||||
local function parsechunk(data)
|
||||
local parts = stdnse.strsplit(":", data)
|
||||
local parts = stringaux.strsplit(":", data)
|
||||
if #parts < 2 then
|
||||
return nil, data
|
||||
end
|
||||
@@ -53,7 +54,7 @@ local function parsechunk(data)
|
||||
if not size then
|
||||
return nil, data
|
||||
end
|
||||
local body = stdnse.strjoin(":", parts)
|
||||
local body = table.concat(parts, ":")
|
||||
if #body < size then
|
||||
return nil, data
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local stdnse = require "stdnse"
|
||||
local shortport = require "shortport"
|
||||
local comm = require "comm"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -189,7 +190,7 @@ local function format_dimensions(res)
|
||||
}
|
||||
|
||||
local values = {}
|
||||
for counter, val in ipairs(stdnse.strsplit("%.%s*", res["Date and Time"])) do
|
||||
for counter, val in ipairs(stringaux.strsplit("%.%s*", res["Date and Time"])) do
|
||||
values[ params[counter] ] = val
|
||||
end
|
||||
|
||||
@@ -217,7 +218,7 @@ local function format_dimensions(res)
|
||||
"d", "h", "m", "s"
|
||||
}
|
||||
|
||||
for counter, v in ipairs(stdnse.strsplit("%.%s*", res["Uptime"])) do
|
||||
for counter, v in ipairs(stringaux.strsplit("%.%s*", res["Uptime"])) do
|
||||
table.insert(t, v .. units[counter])
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local tns = require "tns"
|
||||
local unpwdb = require "unpwdb"
|
||||
|
||||
@@ -190,7 +191,7 @@ action = function(host, port)
|
||||
|
||||
engine.iterator = brute.Iterators.credential_iterator(f)
|
||||
elseif( "accounts" == mode ) then
|
||||
engine.iterator = unpwdb.table_iterator(stdnse.strsplit(",%s*", arg_accounts))
|
||||
engine.iterator = unpwdb.table_iterator(stringaux.strsplit(",%s*", arg_accounts))
|
||||
end
|
||||
|
||||
engine.options.useraspass = false
|
||||
|
||||
@@ -32,12 +32,12 @@ action = function(host, port)
|
||||
local capstrings = {}
|
||||
for cap, args in pairs(capa) do
|
||||
if ( #args > 0 ) then
|
||||
table.insert(capstrings, ("%s(%s)"):format(cap, stdnse.strjoin(" ", args)))
|
||||
table.insert(capstrings, ("%s(%s)"):format(cap, table.concat(args, " ")))
|
||||
else
|
||||
table.insert(capstrings, cap)
|
||||
end
|
||||
end
|
||||
return stdnse.strjoin(" ", capstrings)
|
||||
return table.concat(capstrings, " ")
|
||||
elseif type(err) == "string" then
|
||||
stdnse.debug1("'%s' for %s", err, host.ip)
|
||||
return
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -79,7 +80,7 @@ portrule = shortport.version_port_or_service(range(27960, 27970), {'quake3'}, 'u
|
||||
|
||||
local function parsefields(data)
|
||||
local fields = {}
|
||||
local parts = stdnse.strsplit("\\", data)
|
||||
local parts = stringaux.strsplit("\\", data)
|
||||
local nullprefix = table.remove(parts, 1)
|
||||
if nullprefix ~= "" then
|
||||
stdnse.debug2("unrecognized field format, skipping options")
|
||||
@@ -94,7 +95,7 @@ local function parsefields(data)
|
||||
end
|
||||
|
||||
local function parsename(data)
|
||||
local parts = stdnse.strsplit('"', data)
|
||||
local parts = stringaux.strsplit('"', data)
|
||||
if #parts ~= 3 then
|
||||
return nil
|
||||
end
|
||||
@@ -109,7 +110,7 @@ local function parsename(data)
|
||||
end
|
||||
|
||||
local function parseplayer(data)
|
||||
local parts = stdnse.strsplit(" ", data)
|
||||
local parts = stringaux.strsplit(" ", data)
|
||||
if #parts < 3 then
|
||||
stdnse.debug2("player info line is missing elements, skipping a player")
|
||||
return nil
|
||||
@@ -197,7 +198,7 @@ action = function(host, port)
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
local parts = stdnse.strsplit("\n", data)
|
||||
local parts = stringaux.strsplit("\n", data)
|
||||
local header = table.remove(parts, 1)
|
||||
if header ~= STATUSRESP then
|
||||
return
|
||||
@@ -224,7 +225,7 @@ action = function(host, port)
|
||||
-- "ioq3 1.36+svn1933-1/Ubuntu linux-x86_64 Apr 4 2011"
|
||||
local versionline = basic["version"]
|
||||
if versionline then
|
||||
local fields = stdnse.strsplit(" ", versionline)
|
||||
local fields = stringaux.strsplit(" ", versionline)
|
||||
local product = fields[1]
|
||||
local version = fields[2]
|
||||
local osline = fields[3]
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local tab = require "tab"
|
||||
local table = require "table"
|
||||
|
||||
@@ -103,12 +104,12 @@ local function getservers(host, port, q3protocol)
|
||||
nmap.set_port_version(host, port)
|
||||
|
||||
local EOT = "EOT\0\0\0"
|
||||
local pieces = stdnse.strsplit("\\", data)
|
||||
local pieces = stringaux.strsplit("\\", data)
|
||||
while pieces[#pieces] ~= EOT do -- get all data
|
||||
status, tmp = socket:receive()
|
||||
if status then
|
||||
data = data .. tmp
|
||||
pieces = stdnse.strsplit("\\", data)
|
||||
pieces = stringaux.strsplit("\\", data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -188,7 +189,7 @@ local function protocols()
|
||||
local filter = {}
|
||||
local count = {}
|
||||
for _, advert in ipairs(nmap.registry.q3m_servers) do
|
||||
local key = stdnse.strjoin(":", {advert.ip, advert.port, advert.protocol})
|
||||
local key = table.concat({advert.ip, advert.port, advert.protocol}, ":")
|
||||
if filter[key] == nil then
|
||||
if count[advert.protocol] == nil then
|
||||
count[advert.protocol] = 0
|
||||
@@ -196,7 +197,7 @@ local function protocols()
|
||||
count[advert.protocol] = count[advert.protocol] + 1
|
||||
filter[key] = true
|
||||
end
|
||||
local mkey = stdnse.strjoin(":", {advert.masterip, advert.masterport})
|
||||
local mkey = table.concat({advert.masterip, advert.masterport}, ":")
|
||||
end
|
||||
local sortable = {}
|
||||
for k, v in pairs(count) do
|
||||
|
||||
@@ -4,6 +4,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local ipOps = require "ipOps"
|
||||
|
||||
@@ -92,7 +93,7 @@ local extras = {
|
||||
if data[1] ~= "bind" or not data[2] then
|
||||
return nil
|
||||
end
|
||||
local restab = stdnse.strsplit(" ", data[2])
|
||||
local restab = stringaux.strsplit(" ", data[2])
|
||||
if not restab or 0 == #restab then
|
||||
stdnse.debug1("Failed to parse response from server")
|
||||
return nil
|
||||
@@ -126,7 +127,7 @@ local extras = {
|
||||
},
|
||||
{
|
||||
"Client connections", {"CLIENT", "LIST"}, function(data)
|
||||
local restab = stdnse.strsplit("\n", data)
|
||||
local restab = stringaux.strsplit("\n", data)
|
||||
if not restab or 0 == #restab then
|
||||
stdnse.debug1("Failed to parse response from server")
|
||||
return nil
|
||||
@@ -160,7 +161,7 @@ local extras = {
|
||||
},
|
||||
{
|
||||
"Cluster nodes", {"CLUSTER", "NODES"}, function(data)
|
||||
local restab = stdnse.strsplit("\n", data)
|
||||
local restab = stringaux.strsplit("\n", data)
|
||||
if not restab or 0 == #restab then
|
||||
return nil
|
||||
end
|
||||
@@ -211,7 +212,7 @@ action = function(host, port)
|
||||
return fail(response.data)
|
||||
end
|
||||
|
||||
local restab = stdnse.strsplit("\r\n", response.data)
|
||||
local restab = stringaux.strsplit("\r\n", response.data)
|
||||
if ( not(restab) or 0 == #restab ) then
|
||||
return fail("Failed to parse response from server")
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local datetime = require "datetime"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
|
||||
@@ -38,7 +39,7 @@ action = function(host, port)
|
||||
stamp = string.unpack(">I4", result)
|
||||
port.version.extrainfo = "64 bits"
|
||||
else
|
||||
stdnse.debug1("Odd response: %s", stdnse.filename_escape(result))
|
||||
stdnse.debug1("Odd response: %s", stringaux.filename_escape(result))
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ action = function(host, port)
|
||||
end
|
||||
end
|
||||
|
||||
table.insert( result, ("%-7d %-10s %5d/%s %s"):format(progid, stdnse.strjoin(",", v2.version), v2.port, proto, rpc.Util.ProgNumberToName(progid) or "") )
|
||||
table.insert( result, ("%-7d %-10s %5d/%s %s"):format(progid, table.concat(v2.version, ","), v2.port, proto, rpc.Util.ProgNumberToName(progid) or "") )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local rtsp = require "rtsp"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
description = [[
|
||||
Determines which methods are supported by the RTSP (real time streaming protocol) server.
|
||||
@@ -52,6 +53,6 @@ action = function(host, port)
|
||||
helper:close()
|
||||
if ( status ) then
|
||||
local opts = response.headers['Public']
|
||||
return stdnse.strsplit(",%s*", opts), opts
|
||||
return stringaux.strsplit(",%s*", opts), opts
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ local os = require "os"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -166,7 +167,7 @@ action = function(host, port)
|
||||
-- We should get a response back that has contains one line for the
|
||||
-- agent URN and TCP port
|
||||
local urn, xport, split
|
||||
split = stdnse.strsplit(" ", response)
|
||||
split = stringaux.strsplit(" ", response)
|
||||
urn = split[1]
|
||||
xport = split[2]
|
||||
table.insert(output, "URN: " .. urn)
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local sip = require "sip"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
description = [[
|
||||
Enumerates a SIP Server's allowed methods (INVITE, OPTIONS, SUBSCRIBE, etc.)
|
||||
@@ -58,7 +59,7 @@ action = function(host, port)
|
||||
-- Check if allow header exists in response
|
||||
local allow = response:getHeader("allow")
|
||||
if allow then
|
||||
return stdnse.strsplit(",%s*", allow), allow
|
||||
return stringaux.strsplit(",%s*", allow), allow
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local smb = require "smb"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local unpwdb = require "unpwdb"
|
||||
local rand = require "rand"
|
||||
@@ -183,7 +184,7 @@ end
|
||||
-- for domain.
|
||||
local function split_domain(str)
|
||||
local username, domain
|
||||
local split = stdnse.strsplit("\\", str)
|
||||
local split = stringaux.strsplit("\\", str)
|
||||
|
||||
if(#split > 1) then
|
||||
domain = split[1]
|
||||
@@ -1107,7 +1108,7 @@ action = function(host)
|
||||
table.sort(locked)
|
||||
|
||||
-- Display the list
|
||||
table.insert(response, string.format("Locked accounts found: %s", stdnse.strjoin(", ", locked)))
|
||||
table.insert(response, string.format("Locked accounts found: %s", table.concat(locked, ", ")))
|
||||
end
|
||||
|
||||
return stdnse.format_output(true, response)
|
||||
|
||||
@@ -82,13 +82,13 @@ action = function(host)
|
||||
piece['name'] = domain
|
||||
|
||||
if(#data.groups > 0) then
|
||||
table.insert(piece, string.format("Groups: %s", stdnse.strjoin(", ", data.groups)))
|
||||
table.insert(piece, string.format("Groups: %s", table.concat(data.groups, ", ")))
|
||||
else
|
||||
table.insert(piece, "Groups: n/a")
|
||||
end
|
||||
|
||||
if(#data.users > 0) then
|
||||
table.insert(piece, string.format("Users: %s", stdnse.strjoin(", ", data.users)))
|
||||
table.insert(piece, string.format("Users: %s", table.concat(data.users, ", ")))
|
||||
else
|
||||
table.insert(piece, "Users: n/a")
|
||||
end
|
||||
@@ -105,7 +105,7 @@ action = function(host)
|
||||
data.max_password_age or "n/a",
|
||||
data.password_history or "n/a"))
|
||||
if(data.password_properties and #data.password_properties) then
|
||||
table.insert(piece, string.format("Properties: %s", stdnse.strjoin(", ", data.password_properties)))
|
||||
table.insert(piece, string.format("Properties: %s", table.concat(data.password_properties, ", ")))
|
||||
end
|
||||
|
||||
if(data.lockout_threshold) then
|
||||
|
||||
@@ -269,7 +269,7 @@ action = function(host)
|
||||
-- Produce final output.
|
||||
local response
|
||||
if nmap.verbosity() == 0 then
|
||||
response = "|_ " .. stdnse.strjoin(", ", names)
|
||||
response = "|_ " .. table.concat(names, ", ")
|
||||
else
|
||||
response = "\n" .. psl_print(psl, nmap.verbosity())
|
||||
end
|
||||
|
||||
@@ -238,7 +238,7 @@ action = function(host)
|
||||
end
|
||||
|
||||
-- Add this domain to the response
|
||||
table.insert(response, string.format("Domain: %s; Users: %s", domain, stdnse.strjoin(", ", names)))
|
||||
table.insert(response, string.format("Domain: %s; Users: %s", domain, table.concat(names, ", ")))
|
||||
end
|
||||
else
|
||||
for domain, domain_users in pairs(domains) do
|
||||
@@ -253,7 +253,7 @@ action = function(host)
|
||||
table.insert(response_part, string.format("Description: %s", info['description']))
|
||||
end
|
||||
if(info['flags']) then
|
||||
table.insert(response_part, string.format("Flags: %s", stdnse.strjoin(", ", info['flags'])))
|
||||
table.insert(response_part, string.format("Flags: %s", table.concat(info['flags'], ", ")))
|
||||
end
|
||||
|
||||
table.insert(response, response_part)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local smb = require 'smb'
|
||||
local string = require 'string'
|
||||
local stringaux = require "stringaux"
|
||||
local stdnse = require 'stdnse'
|
||||
local ls = require 'ls'
|
||||
|
||||
@@ -170,7 +171,7 @@ action = function(host)
|
||||
|
||||
-- give priority to specified shares if specified
|
||||
if arg_shares ~= nil then
|
||||
arg_shares = stdnse.strsplit(":", arg_shares)
|
||||
arg_shares = stringaux.strsplit(":", arg_shares)
|
||||
elseif arg_share ~= nil then
|
||||
arg_shares = {arg_share}
|
||||
else
|
||||
|
||||
@@ -215,7 +215,7 @@ action = function(host, port)
|
||||
|
||||
if ( format == OutputFormat.BY_TYPE_H ) then
|
||||
for k, v in pairs(results) do
|
||||
local row = ("%s: %s"):format( k, stdnse.strjoin(",", v) )
|
||||
local row = ("%s: %s"):format( k, table.concat(v, ",") )
|
||||
table.insert(output, row)
|
||||
end
|
||||
table.sort(output)
|
||||
|
||||
@@ -136,7 +136,7 @@ function make_cpe(result)
|
||||
end
|
||||
|
||||
if #parts > 0 then
|
||||
return "cpe:/" .. stdnse.strjoin(":", parts)
|
||||
return "cpe:/" .. table.concat(parts, ":")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ local nmap = require "nmap"
|
||||
local smb = require "smb"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -727,7 +728,7 @@ local function find_share(host)
|
||||
if(path == nil) then
|
||||
return false, string.format("Couldn't find path to writable share (we probably don't have admin access): '%s'", share)
|
||||
end
|
||||
stdnse.debug1("Found usable share %s (%s) (all writable shares: %s)", share, path, stdnse.strjoin(", ", shares))
|
||||
stdnse.debug1("Found usable share %s (%s) (all writable shares: %s)", share, path, table.concat(shares, ", "))
|
||||
end
|
||||
|
||||
return true, share, path, shares
|
||||
@@ -941,7 +942,7 @@ local function get_config(host, config)
|
||||
if(#missing_args > 0) then
|
||||
enabled = false
|
||||
mod.disabled_message = {}
|
||||
table.insert(mod.disabled_message, string.format("Configuration error: Required argument(s) ('%s') weren't given.", stdnse.strjoin("', '", missing_args)))
|
||||
table.insert(mod.disabled_message, string.format("Configuration error: Required argument(s) ('%s') weren't given.", table.concat('", missing_args, "')))
|
||||
table.insert(mod.disabled_message, "Please add --script-args=[arg]=[value] to your commandline to run this module")
|
||||
if(#missing_args == 1) then
|
||||
table.insert(mod.disabled_message, string.format("For example: --script-args=%s=123", missing_args[1]))
|
||||
@@ -1355,7 +1356,7 @@ local function parse_output(config, data)
|
||||
data = data or ""
|
||||
|
||||
-- Split the result at newlines
|
||||
local lines = stdnse.strsplit("\n", data)
|
||||
local lines = stringaux.strsplit("\n", data)
|
||||
|
||||
local module_num = -1
|
||||
local mod = nil
|
||||
@@ -1496,7 +1497,7 @@ and place it in nselib/data/psexec/ under the Nmap DATADIR.
|
||||
table.insert(response, "* Running the script with --script-args=cleanup=1 to force a cleanup (passing -d and looking for error messages might help),")
|
||||
table.insert(response, "* Running the script with --script-args=randomseed=ABCD (or something) to change the name of the uploaded files,")
|
||||
table.insert(response, "* Changing the share and path using, for example, --script-args=share=C$,sharepath=C:, or")
|
||||
table.insert(response, "* Deleting the affected file(s) off the server manually (\\\\" .. config.share .. "\\" .. stdnse.strjoin(", \\\\" .. config.share .. "\\", files) .. ")")
|
||||
table.insert(response, "* Deleting the affected file(s) off the server manually (\\\\" .. config.share .. "\\" .. table.concat(files, ", \\\\" .. config.share .. "\\") .. ")")
|
||||
return stdnse.format_output(false, response)
|
||||
end
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ action = function(host, port)
|
||||
for index, test in ipairs(result) do
|
||||
table.insert(final, test)
|
||||
end
|
||||
return stdnse.strjoin("\n ", final)
|
||||
return table.concat(final, "\n ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -280,7 +280,7 @@ action = function(host, port)
|
||||
end
|
||||
end
|
||||
|
||||
return stdnse.strjoin("\n ", final)
|
||||
return table.concat(final, "\n ")
|
||||
end
|
||||
|
||||
return "Server doesn't seem to be an open relay, all tests failed"
|
||||
|
||||
@@ -3,6 +3,7 @@ local shortport = require "shortport"
|
||||
local smtp = require "smtp"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
description = [[
|
||||
@@ -366,7 +367,7 @@ local function check_exim(smtp_opts)
|
||||
return smtp_finish(nil, status, response)
|
||||
end
|
||||
|
||||
for _, line in pairs(stdnse.strsplit("\r?\n", response)) do
|
||||
for _, line in pairs(stringaux.strsplit("\r?\n", response)) do
|
||||
if not smtp_opts.ehlo_host or not smtp_opts.domain_ip then
|
||||
smtp_opts.ehlo_host, smtp_opts.domain_ip =
|
||||
line:match("%d.-Hello%s(.*)%s%[([^]]*)%]")
|
||||
|
||||
@@ -2,6 +2,7 @@ local shortport = require "shortport"
|
||||
local smtp = require "smtp"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local vulns = require "vulns"
|
||||
|
||||
@@ -168,7 +169,7 @@ local function check_smtpd(smtp_opts)
|
||||
local auth_mech_list, auth_mech_str = {}, ""
|
||||
|
||||
-- parse server response
|
||||
for _, line in pairs(stdnse.strsplit("\r?\n", response)) do
|
||||
for _, line in pairs(stringaux.strsplit("\r?\n", response)) do
|
||||
if not next(auth_mech_list) then
|
||||
auth_mech_str = chk_auth_mechanisms(line, auth_mech_list)
|
||||
end
|
||||
@@ -192,7 +193,7 @@ local function check_smtpd(smtp_opts)
|
||||
return status, response
|
||||
end
|
||||
|
||||
for _, line in pairs(stdnse.strsplit("\r?\n", response)) do
|
||||
for _, line in pairs(stringaux.strsplit("\r?\n", response)) do
|
||||
if not next(auth_mech_list) then
|
||||
auth_mech_str = chk_auth_mechanisms(line, auth_mech_list)
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local snmp = require "snmp"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tftp = require "tftp"
|
||||
|
||||
@@ -151,7 +152,7 @@ action = function(host, port)
|
||||
result = ( infile and infile:getContent() )
|
||||
|
||||
if ( tftproot ) then
|
||||
local fname = tftproot .. stdnse.filename_escape(host.ip .. "-config")
|
||||
local fname = tftproot .. stringaux.filename_escape(host.ip .. "-config")
|
||||
local file, err = io.open(fname, "w")
|
||||
if ( file ) then
|
||||
file:write(result)
|
||||
|
||||
@@ -5,6 +5,7 @@ local ssh1 = require "ssh1"
|
||||
local ssh2 = require "ssh2"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local tableaux = require "table"
|
||||
local base64 = require "base64"
|
||||
@@ -168,7 +169,7 @@ local function check_keys(host, keys, f)
|
||||
-- the line might be hashed
|
||||
if string.match(parts[1], "^|") then
|
||||
-- split the first part of the line - it contains base64'ed salt and hashed hostname
|
||||
local parts_hostname = stdnse.strsplit("|", parts[1])
|
||||
local parts_hostname = stringaux.strsplit("|", parts[1])
|
||||
if #parts_hostname == 4 then
|
||||
-- check if the hash corresponds to the host being scanned
|
||||
local salt = base64.dec(parts_hostname[3])
|
||||
|
||||
@@ -2,6 +2,7 @@ local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
|
||||
local openssl = stdnse.silent_require "openssl"
|
||||
@@ -136,7 +137,7 @@ local output = function(parsed, lists)
|
||||
|
||||
for _, l in ipairs(lists) do
|
||||
local v = parsed[l]
|
||||
local a = v:len() > 0 and stdnse.strsplit(",", v) or {}
|
||||
local a = v:len() > 0 and stringaux.strsplit(",", v) or {}
|
||||
if nmap.verbosity() > 0 then
|
||||
setmetatable(a, {
|
||||
__tostring = function(t)
|
||||
|
||||
@@ -2,6 +2,7 @@ local shortport = require "shortport"
|
||||
local sslcert = require "sslcert"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
local ipOps = require "ipOps"
|
||||
|
||||
description = [[
|
||||
@@ -86,7 +87,7 @@ local searchCertField = function(certField, certFieldName)
|
||||
-- if the name of this X509 field is numeric object identifier
|
||||
-- (i.e. "1.2.33.4..")
|
||||
if type(k)=="table" then
|
||||
k = stdnse.strjoin(".", k)
|
||||
k = table.concat(k, ".")
|
||||
end
|
||||
|
||||
stdnse.debug2("search %s %s", certFieldName, k)
|
||||
|
||||
@@ -4,6 +4,7 @@ local shortport = require "shortport"
|
||||
local sslcert = require "sslcert"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
local tls = require "tls"
|
||||
local unicode = require "unicode"
|
||||
|
||||
@@ -187,20 +188,20 @@ function stringify_name(name)
|
||||
-- Don't include a field twice.
|
||||
if not table_find(NON_VERBOSE_FIELDS, k) then
|
||||
if type(k) == "table" then
|
||||
k = stdnse.strjoin(".", k)
|
||||
k = table.concat(k, ".")
|
||||
end
|
||||
fields[#fields + 1] = string.format("%s=%s", k, maybe_decode(v) or '')
|
||||
end
|
||||
end
|
||||
end
|
||||
return stdnse.strjoin("/", fields)
|
||||
return table.concat(fields, "/")
|
||||
end
|
||||
|
||||
local function name_to_table(name)
|
||||
local output = {}
|
||||
for k, v in pairs(name) do
|
||||
if type(k) == "table" then
|
||||
k = stdnse.strjoin(".", k)
|
||||
k = table.concat(k, ".")
|
||||
end
|
||||
output[k] = v
|
||||
end
|
||||
@@ -264,7 +265,7 @@ local function output_str(cert)
|
||||
if nmap.verbosity() > 1 then
|
||||
lines[#lines + 1] = cert.pem
|
||||
end
|
||||
return stdnse.strjoin("\n", lines)
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
@@ -2,6 +2,7 @@ local io = require "io"
|
||||
local msrpc = require "msrpc"
|
||||
local smb = require "smb"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
|
||||
-- -*- mode: lua -*-
|
||||
-- vim: set filetype=lua :
|
||||
@@ -82,7 +83,7 @@ local function check_infected(host, path, save)
|
||||
|
||||
fmt = save:gsub("%%h", host.ip)
|
||||
fmt = fmt:gsub("%%v", version)
|
||||
file = io.open(stdnse.filename_escape(fmt), "w")
|
||||
file = io.open(stringaux.filename_escape(fmt), "w")
|
||||
if file then
|
||||
stdnse.debug1("Wrote %d bytes to file %s.", #result.arguments, fmt)
|
||||
file:write(result.arguments)
|
||||
|
||||
@@ -3,6 +3,7 @@ local creds = require "creds"
|
||||
local nmap = require "nmap"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local openssl = stdnse.silent_require "openssl"
|
||||
|
||||
description = [[
|
||||
@@ -94,7 +95,7 @@ svn =
|
||||
if ( msg:match("%( success") ) then
|
||||
local tmp = msg:match("%( success %( %( ([%S+%s*]-) %)")
|
||||
if ( not(tmp) ) then return false, "Failed to detect authentication" end
|
||||
tmp = stdnse.strsplit(" ", tmp)
|
||||
tmp = stringaux.strsplit(" ", tmp)
|
||||
self.auth_mech = {}
|
||||
for _, v in pairs(tmp) do self.auth_mech[v] = true end
|
||||
elseif ( msg:match("%( failure") ) then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
|
||||
@@ -81,7 +82,7 @@ action = function(host, port)
|
||||
table.insert(prefixes, err)
|
||||
break
|
||||
else
|
||||
for i, prefix in ipairs(stdnse.strsplit("\n",data)) do
|
||||
for i, prefix in ipairs(stringaux.strsplit("\n",data)) do
|
||||
if ( #prefix > 1 ) then
|
||||
table.insert(prefixes,prefix)
|
||||
if target.ALLOW_NEW_TARGETS then
|
||||
|
||||
@@ -2,6 +2,7 @@ local ipOps = require "ipOps"
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local table = require "table"
|
||||
local target = require "target"
|
||||
|
||||
@@ -61,7 +62,7 @@ categories = {
|
||||
}
|
||||
|
||||
local function split_prefix (net)
|
||||
local split = stdnse.strsplit("/", net)
|
||||
local split = stringaux.strsplit("/", net)
|
||||
return split[1], tonumber(split[2])
|
||||
end
|
||||
---
|
||||
|
||||
@@ -2,6 +2,7 @@ local ipOps = require "ipOps"
|
||||
local nmap = require "nmap"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local stringaux = require "stringaux"
|
||||
local target = require "target"
|
||||
local datafiles = require "datafiles"
|
||||
local table = require "table"
|
||||
@@ -48,7 +49,7 @@ categories = {
|
||||
}
|
||||
|
||||
local function split_prefix (net)
|
||||
local split = stdnse.strsplit("/", net)
|
||||
local split = stringaux.strsplit("/", net)
|
||||
return split[1], tonumber(split[2])
|
||||
end
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ action = function()
|
||||
|
||||
packet_counter=packet_counter+1
|
||||
addresses = get_ip_addresses(layer3)
|
||||
stdnse.debug1("Got IP addresses %s", stdnse.strjoin(" ", addresses))
|
||||
stdnse.debug1("Got IP addresses %s", table.concat(addresses, " "))
|
||||
|
||||
for _, addr in ipairs(addresses) do
|
||||
if check_if_valid(addr) == true then
|
||||
@@ -147,5 +147,5 @@ action = function()
|
||||
stdnse.debug1("Added %s address(es) to newtargets", #all_addresses)
|
||||
end
|
||||
|
||||
return string.format("Sniffed %s address(es). \n", #all_addresses) .. stdnse.strjoin("\n",all_addresses)
|
||||
return string.format("Sniffed %s address(es). \n", #all_addresses) .. table.concat(all_addresses, "\n")
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user