mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +00:00
Remove useless calls to string.format
stdnse.print_debug accepts a format string and arguments, making
string.format redundant in calls of this form:
stdnse.print_debug(1, string.format("%s: error", SCRIPT_NAME))
stdnse.print_debug(("length %d"):format(#tab))
These can be rewritten as:
stdnse.print_debug(1, "%s: error", SCRIPT_NAME)
stdnse.print_debug("length %d", #tab)
This commit is contained in:
@@ -48,28 +48,28 @@ action = function( host, port )
|
||||
|
||||
local result = {}
|
||||
local uri = "/tasktracker.jsp"
|
||||
stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri))
|
||||
stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri)
|
||||
local response = http.get( host, port, uri )
|
||||
stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response"))
|
||||
stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response")
|
||||
if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then
|
||||
local body = response['body']:gsub("%%","%%%%")
|
||||
stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body))
|
||||
stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body)
|
||||
if response['body']:match("Version:</b>%s*([^][<]+)") then
|
||||
local version = response['body']:match("Version:</b>%s*([^][<]+)")
|
||||
local versionNo = version:match("([^][,]+)")
|
||||
local versionHash = version:match("[^][,]+%s+(%w+)")
|
||||
stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash))
|
||||
stdnse.print_debug(1, "%s: Version %s (%s)", SCRIPT_NAME,versionNo,versionHash)
|
||||
table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash))
|
||||
port.version.version = version
|
||||
end
|
||||
if response['body']:match("Compiled:</b>%s*([^][<]+)") then
|
||||
local compiled = response['body']:match("Compiled:</b>%s*([^][<]+)"):gsub("%s+", " ")
|
||||
stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled))
|
||||
stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled)
|
||||
table.insert(result, ("Compiled: %s"):format(compiled))
|
||||
end
|
||||
if body:match("([^][\"]+)\">Log") then
|
||||
local logs = body:match("([^][\"]+)\">Log")
|
||||
stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs))
|
||||
stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs)
|
||||
table.insert(result, ("Logs: %s"):format(logs))
|
||||
end
|
||||
if #result > 0 then
|
||||
|
||||
Reference in New Issue
Block a user