1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-13 11:19:02 +00:00

From Jason R. DePriest:

Fixed it to normalize the line endings before replacing them with
commas and I have it remove extra spaces.
This commit is contained in:
fyodor
2008-10-07 03:54:46 +00:00
parent 2c6554a435
commit 840b276b6c

View File

@@ -33,6 +33,10 @@
-- 1.5.0.0 - 2008-08-15 -- 1.5.0.0 - 2008-08-15
-- + updated to use the nsedoc documentation system -- + updated to use the nsedoc documentation system
-- 1.6.0.0 - 2008-10-06
-- + Updated gsubs to handle different formats, pulls out extra spaces
-- and normalizes line endings
-- Cribbed heavily from Thomas Buchanan's SQL version detection -- Cribbed heavily from Thomas Buchanan's SQL version detection
-- script and from Arturo 'Buanzo' Busleiman's SMTP open relay -- script and from Arturo 'Buanzo' Busleiman's SMTP open relay
-- detector script. -- detector script.
@@ -90,8 +94,11 @@ action = function(host, port)
resultEHLO = string.gsub(resultEHLO, "250 OK[\r\n]", "") -- 250 OK (needed to have the \r\n in there) resultEHLO = string.gsub(resultEHLO, "250 OK[\r\n]", "") -- 250 OK (needed to have the \r\n in there)
-- get rid of the 250- at the beginning of each line in the response -- get rid of the 250- at the beginning of each line in the response
resultEHLO = string.gsub(resultEHLO, "250%-", "") -- 250- resultEHLO = string.gsub(resultEHLO, "250%-", "") -- 250-
resultEHLO = string.gsub(resultEHLO,"[\r\n]+$", "") -- no final CR LF resultEHLO = string.gsub(resultEHLO, "\r\n", "\n") -- normalize CR LF
resultEHLO = string.gsub(resultEHLO, "\r\n", ", ") -- CR LF to comma resultEHLO = string.gsub(resultEHLO, "\n\r", "\n") -- normalize LF CR
resultEHLO = string.gsub(resultEHLO, "\n+$", "") -- no final LF
resultEHLO = string.gsub(resultEHLO, "\n", ", ") -- LF to comma
resultEHLO = string.gsub(resultEHLO, "%s+", " ") -- get rid of extra spaces
resultEHLO = "\nEHLO " .. resultEHLO resultEHLO = "\nEHLO " .. resultEHLO
end end
@@ -108,8 +115,11 @@ action = function(host, port)
resultHELP = string.gsub(resultHELP, "214%-", "") -- 214- resultHELP = string.gsub(resultHELP, "214%-", "") -- 214-
-- get rid of the 214 at the beginning of the lines in the response -- get rid of the 214 at the beginning of the lines in the response
resultHELP = string.gsub(resultHELP, "214 ", "") -- 214 resultHELP = string.gsub(resultHELP, "214 ", "") -- 214
resultHELP = string.gsub(resultHELP,"[\r\n]+$", "") -- no final CR LF resultHELP = string.gsub(resultHELP, "\r\n", "\n") -- normalize CR LF
resultHELP = string.gsub(resultHELP, "[\r\n]", ", ") -- CR LF to comma resultHELP = string.gsub(resultHELP, "\n\r", "\n") -- normalize LF CR
resultHELP = string.gsub(resultHELP, "\n+$", "") -- no final LF
resultHELP = string.gsub(resultHELP, "\n", ", ") -- LF to comma
resultHELP = string.gsub(resultHELP, "%s+", " ") -- get rid of extra spaces
resultHELP = "\nHELP " .. resultHELP resultHELP = "\nHELP " .. resultHELP
end end