mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 20:51:30 +00:00
Adjust the output of http-trace and pop3-capabilities to avoid overly long
lines.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user