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)
|
-- Initialize the output string to blank (or, if we're at the top, add a newline)
|
||||||
local output = ""
|
local output = ""
|
||||||
if(not(indent)) then
|
if(not(indent)) then
|
||||||
output = ' \n'
|
output = '\n'
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not(status)) then
|
if(not(status)) then
|
||||||
@@ -556,7 +556,7 @@ function format_output(status, data, indent)
|
|||||||
local result = format_output_sub(status, data, indent)
|
local result = format_output_sub(status, data, indent)
|
||||||
|
|
||||||
-- Check for an empty result
|
-- 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
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -457,6 +457,6 @@ function nice_output( output, combined_records )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- return combined and formatted answers
|
-- return combined and formatted answers
|
||||||
return (" \n%s"):format( table.concat( output, "\n" ) )
|
return "\n" .. table.concat( output, "\n" )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function create_result_from_table(accounts)
|
|||||||
result = result .. " " .. account.username .. ":" .. account.password .. " => " .. account.message .. "\n"
|
result = result .. " " .. account.username .. ":" .. account.password .. " => " .. account.message .. "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
return " \n" .. result
|
return "\n" .. result
|
||||||
end
|
end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ action = function(host, port)
|
|||||||
local output = stdnse.format_output( true, results )
|
local output = stdnse.format_output( true, results )
|
||||||
|
|
||||||
if limit > 0 then
|
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
|
end
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|||||||
@@ -406,5 +406,5 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
soc:close()
|
soc:close()
|
||||||
return ' \n' .. tab.dump(table)
|
return '\n' .. tab.dump(table)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -442,6 +442,6 @@ action = function(host)
|
|||||||
sock:ip_close()
|
sock:ip_close()
|
||||||
pcap:pcap_close()
|
pcap:pcap_close()
|
||||||
|
|
||||||
return " \n" .. report(ports, fwdports)
|
return "\n" .. report(ports, fwdports)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ function action(host,port)
|
|||||||
-- catch any softerrors
|
-- catch any softerrors
|
||||||
if searchResEntries.resultCode ~= 0 then
|
if searchResEntries.resultCode ~= 0 then
|
||||||
local output = stdnse.format_output(true, result )
|
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
|
return output
|
||||||
end
|
end
|
||||||
@@ -233,7 +233,7 @@ function action(host,port)
|
|||||||
local output = stdnse.format_output(true, result )
|
local output = stdnse.format_output(true, result )
|
||||||
|
|
||||||
if ( maxObjects ~= -1 and objCount == maxObjects ) then
|
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
|
end
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|||||||
@@ -507,6 +507,6 @@ action = function(host)
|
|||||||
|
|
||||||
calcfamilies(stats, conf)
|
calcfamilies(stats, conf)
|
||||||
|
|
||||||
return " \n" .. report(stats)
|
return "\n" .. report(stats)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ action = function(host)
|
|||||||
if nmap.verbosity() == 0 then
|
if nmap.verbosity() == 0 then
|
||||||
response = "|_ " .. stdnse.strjoin(", ", names)
|
response = "|_ " .. stdnse.strjoin(", ", names)
|
||||||
else
|
else
|
||||||
response = " \n" .. psl_print(psl, nmap.verbosity())
|
response = "\n" .. psl_print(psl, nmap.verbosity())
|
||||||
end
|
end
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -1281,14 +1281,14 @@ function format_data_for_output( data )
|
|||||||
for _, field_name in ipairs( fields ) do
|
for _, field_name in ipairs( fields ) do
|
||||||
if type( field_name ) == "string" and data[object_name][field_name] then
|
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] = field_name
|
||||||
output[#output+1] = ": "
|
output[#output+1] = ": "
|
||||||
output[#output+1] = data[object_name][field_name]
|
output[#output+1] = data[object_name][field_name]
|
||||||
|
|
||||||
elseif type( field_name ) == "table" then
|
elseif type( field_name ) == "table" then
|
||||||
|
|
||||||
output[#output+1] = " \n"
|
output[#output+1] = "\n"
|
||||||
|
|
||||||
for _, field_name_sameline in ipairs( field_name ) do
|
for _, field_name_sameline in ipairs( field_name ) do
|
||||||
if type( field_name_sameline ) == "string" and data[object_name][field_name_sameline] then
|
if type( field_name_sameline ) == "string" and data[object_name][field_name_sameline] then
|
||||||
|
|||||||
Reference in New Issue
Block a user