mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Change " \n" to just "\n" where appropriate in NSE. Leading newlines are
no longer removed from script output.
This commit is contained in:
@@ -440,7 +440,7 @@ local function format_output_sub(status, data, indent)
|
||||
-- Initialize the output string to blank (or, if we're at the top, add a newline)
|
||||
local output = ""
|
||||
if(not(indent)) then
|
||||
output = ' \n'
|
||||
output = '\n'
|
||||
end
|
||||
|
||||
if(not(status)) then
|
||||
@@ -556,7 +556,7 @@ function format_output(status, data, indent)
|
||||
local result = format_output_sub(status, data, indent)
|
||||
|
||||
-- Check for an empty result
|
||||
if(result == nil or #result == "" or result == "\n" or result == " \n") then
|
||||
if(result == nil or #result == "" or result == "\n" or result == "\n") then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -457,6 +457,6 @@ function nice_output( output, combined_records )
|
||||
end
|
||||
|
||||
-- return combined and formatted answers
|
||||
return (" \n%s"):format( table.concat( output, "\n" ) )
|
||||
return "\n" .. table.concat( output, "\n" )
|
||||
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ function create_result_from_table(accounts)
|
||||
result = result .. " " .. account.username .. ":" .. account.password .. " => " .. account.message .. "\n"
|
||||
end
|
||||
|
||||
return " \n" .. result
|
||||
return "\n" .. result
|
||||
end
|
||||
|
||||
action = function(host, port)
|
||||
|
||||
@@ -326,7 +326,7 @@ action = function(host, port)
|
||||
local output = stdnse.format_output( true, results )
|
||||
|
||||
if limit > 0 then
|
||||
output = output .. string.format(" \n\nOutput limited to %d items", limit )
|
||||
output = output .. string.format("\n\nOutput limited to %d items", limit )
|
||||
end
|
||||
|
||||
return output
|
||||
|
||||
@@ -406,5 +406,5 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
soc:close()
|
||||
return ' \n' .. tab.dump(table)
|
||||
return '\n' .. tab.dump(table)
|
||||
end
|
||||
|
||||
@@ -442,6 +442,6 @@ action = function(host)
|
||||
sock:ip_close()
|
||||
pcap:pcap_close()
|
||||
|
||||
return " \n" .. report(ports, fwdports)
|
||||
return "\n" .. report(ports, fwdports)
|
||||
end
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ function action(host,port)
|
||||
-- catch any softerrors
|
||||
if searchResEntries.resultCode ~= 0 then
|
||||
local output = stdnse.format_output(true, result )
|
||||
output = output .. string.format(" \n\n\n=========== %s ===========", searchResEntries.errorMessage )
|
||||
output = output .. string.format("\n\n\n=========== %s ===========", searchResEntries.errorMessage )
|
||||
|
||||
return output
|
||||
end
|
||||
@@ -233,7 +233,7 @@ function action(host,port)
|
||||
local output = stdnse.format_output(true, result )
|
||||
|
||||
if ( maxObjects ~= -1 and objCount == maxObjects ) then
|
||||
output = output .. (" \n\nResult limited to %d objects (see ldap.maxobjects)"):format(maxObjects)
|
||||
output = output .. ("\n\nResult limited to %d objects (see ldap.maxobjects)"):format(maxObjects)
|
||||
end
|
||||
|
||||
return output
|
||||
|
||||
@@ -507,6 +507,6 @@ action = function(host)
|
||||
|
||||
calcfamilies(stats, conf)
|
||||
|
||||
return " \n" .. report(stats)
|
||||
return "\n" .. report(stats)
|
||||
end
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ action = function(host)
|
||||
if nmap.verbosity() == 0 then
|
||||
response = "|_ " .. stdnse.strjoin(", ", names)
|
||||
else
|
||||
response = " \n" .. psl_print(psl, nmap.verbosity())
|
||||
response = "\n" .. psl_print(psl, nmap.verbosity())
|
||||
end
|
||||
|
||||
return response
|
||||
|
||||
@@ -1281,14 +1281,14 @@ function format_data_for_output( data )
|
||||
for _, field_name in ipairs( fields ) do
|
||||
if type( field_name ) == "string" and data[object_name][field_name] then
|
||||
|
||||
output[#output+1] = " \n"
|
||||
output[#output+1] = "\n"
|
||||
output[#output+1] = field_name
|
||||
output[#output+1] = ": "
|
||||
output[#output+1] = data[object_name][field_name]
|
||||
|
||||
elseif type( field_name ) == "table" then
|
||||
|
||||
output[#output+1] = " \n"
|
||||
output[#output+1] = "\n"
|
||||
|
||||
for _, field_name_sameline in ipairs( field_name ) do
|
||||
if type( field_name_sameline ) == "string" and data[object_name][field_name_sameline] then
|
||||
|
||||
Reference in New Issue
Block a user