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

Adjust the output of http-trace and pop3-capabilities to avoid overly long

lines.
This commit is contained in:
david
2008-11-10 23:44:49 +00:00
parent 5a418c9c23
commit e09dba77d1
2 changed files with 8 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ response.
-- @output -- @output
-- 80/tcp open http -- 80/tcp open http
-- | http-trace: Response differs from request. First 5 additional lines: -- | http-trace: Response differs from request. First 5 additional lines:
-- | Cookie: UID=d4287aa38d02f409841b4e0c0050c13148a85d01c0c0a154d4ef56dfc2b4fc1b0 -- | Cookie: UID=d4287aa38d02f409841b4e0c0050c131...
-- | Country: us -- | Country: us
-- | Ip_is_advertise_combined: yes -- | Ip_is_advertise_combined: yes
-- | Ip_conntype-Confidence: -1 -- | Ip_conntype-Confidence: -1

View File

@@ -5,7 +5,7 @@ Retrieves POP3 email server capabilities.
--- ---
-- @output -- @output
-- 110/tcp open pop3 -- 110/tcp open pop3
-- |_ pop3-capabilities: USER CAPA RESP-CODES UIDL PIPELINING STLS TOP SASL(PLAIN) -- |_ pop3-capabilities: USER CAPA RESP-CODES UIDL PIPELINING STLS TOP SASL(PLAIN)
author = "Philip Pickering <pgpickering@gmail.com>" author = "Philip Pickering <pgpickering@gmail.com>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html" license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -14,16 +14,18 @@ categories = {"default"}
require 'pop3' require 'pop3'
require 'shortport' require 'shortport'
require 'stdnse'
portrule = shortport.port_or_service({110}, "pop3") portrule = shortport.port_or_service({110}, "pop3")
action = function(host, port) action = function(host, port)
local capa = pop3.capabilities(host, port) local capa = pop3.capabilities(host, port)
if capa then if capa then
local capstr = "" -- Convert the capabilities table into an array of strings.
local capstrings = {}
local cap, args local cap, args
for cap, args in pairs(capa) do for cap, args in pairs(capa) do
capstr = capstr .. " " .. cap local capstr = cap
if type(args) == "string" then capstr = capstr .. "(" .. args .. ")" end if type(args) == "string" then capstr = capstr .. "(" .. args .. ")" end
if type(args) == "table" then if type(args) == "table" then
local arg local arg
@@ -33,8 +35,9 @@ action = function(host, port)
end end
capstr = string.sub(capstr, 1, #capstr - 1) .. ")" capstr = string.sub(capstr, 1, #capstr - 1) .. ")"
end end
table.insert(capstrings, capstr)
end end
return capstr return stdnse.strjoin(" ", capstrings)
else else
return "server doesn't support CAPA" return "server doesn't support CAPA"
end end