1
0
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:
david
2010-09-30 05:03:39 +00:00
parent fe55182068
commit e7fc9c4c5f
10 changed files with 13 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -406,5 +406,5 @@ action = function(host, port)
end
soc:close()
return ' \n' .. tab.dump(table)
return '\n' .. tab.dump(table)
end

View File

@@ -442,6 +442,6 @@ action = function(host)
sock:ip_close()
pcap:pcap_close()
return " \n" .. report(ports, fwdports)
return "\n" .. report(ports, fwdports)
end

View File

@@ -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

View File

@@ -507,6 +507,6 @@ action = function(host)
calcfamilies(stats, conf)
return " \n" .. report(stats)
return "\n" .. report(stats)
end

View File

@@ -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

View File

@@ -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