1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31: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

@@ -5,7 +5,7 @@ Retrieves POP3 email server capabilities.
---
-- @output
-- 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>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
@@ -14,16 +14,18 @@ categories = {"default"}
require 'pop3'
require 'shortport'
require 'stdnse'
portrule = shortport.port_or_service({110}, "pop3")
action = function(host, port)
local capa = pop3.capabilities(host, port)
if capa then
local capstr = ""
-- Convert the capabilities table into an array of strings.
local capstrings = {}
local cap, args
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) == "table" then
local arg
@@ -33,8 +35,9 @@ action = function(host, port)
end
capstr = string.sub(capstr, 1, #capstr - 1) .. ")"
end
table.insert(capstrings, capstr)
end
return capstr
return stdnse.strjoin(" ", capstrings)
else
return "server doesn't support CAPA"
end