1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Improve output formatting

- EHLO output no longer has a trailing separator
- Strings "214" and "250" are now removed only from the line beginning
This commit is contained in:
nnposter
2020-12-27 00:38:53 +00:00
parent eecf225310
commit f6fbb29481

View File

@@ -93,19 +93,19 @@ function go(host, port)
return status, response return status, response
end end
response = string.gsub(response, "250[%-%s]+", "") -- 250 or 250- response = response:gsub("\r", "") -- switch to simple LF line termination
response = string.gsub(response, "\r\n", "\n") -- normalize CR LF :gsub("^%s*(.-)%s*$", "%1") -- trim leading and trailing whitespace
response = string.gsub(response, "\n\r", "\n") -- normalize LF CR :gsub("%f[^\0\n]250[-%s]+", "") -- remove line prefix 250 or 250-
response = string.gsub(response, "^\n+(.-)\n+$", "%1") :gsub("\n", ", ") -- LF to comma
response = string.gsub(response, "\n", ", ") -- LF to comma :gsub("%s+", " ") -- get rid of extra spaces
response = string.gsub(response, "%s+", " ") -- get rid of extra spaces
table.insert(result,response) table.insert(result,response)
status, response = smtp.help(socket) status, response = smtp.help(socket)
if status then if status then
response = string.gsub(response, "214[%-%s]+", "") -- 214 response = response:gsub("\r", "") -- switch to simple LF line termination
response = string.gsub(response, "^%s+(.-)%s+$", "%1") :gsub("^%s*(.-)%s*$", "%1") -- trim leading and trailing whitespace
response = string.gsub(response, "%s+", " ") -- get rid of extra spaces :gsub("%f[^\0\n]214[-%s]+", "") -- remove line prefix 214 or 214-
:gsub("%s+", " ") -- get rid of extra spaces
table.insert(result,response) table.insert(result,response)
smtp.quit(socket) smtp.quit(socket)
end end