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