diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:42:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:42:04 +0000 |
commit | 0d47952611198ef6b1163f366dc03922d20b1475 (patch) | |
tree | 3d840a3b8c0daef0754707bfb9f5e873b6b1ac13 /scripts/pop3-capabilities.nse | |
parent | Initial commit. (diff) | |
download | nmap-upstream.tar.xz nmap-upstream.zip |
Adding upstream version 7.94+git20230807.3be01efb1+dfsg.upstream/7.94+git20230807.3be01efb1+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/pop3-capabilities.nse')
-rw-r--r-- | scripts/pop3-capabilities.nse | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/pop3-capabilities.nse b/scripts/pop3-capabilities.nse new file mode 100644 index 0000000..322bc1a --- /dev/null +++ b/scripts/pop3-capabilities.nse @@ -0,0 +1,47 @@ +local pop3 = require "pop3" +local shortport = require "shortport" +local stdnse = require "stdnse" +local table = require "table" + +description = [[ +Retrieves POP3 email server capabilities. + +POP3 capabilities are defined in RFC 2449. The CAPA command allows a client to +ask a server what commands it supports and possibly any site-specific policy. +Besides the list of supported commands, the IMPLEMENTATION string giving the +server version may be available. +]] + +--- +-- @output +-- 110/tcp open pop3 +-- |_ pop3-capabilities: USER CAPA RESP-CODES UIDL PIPELINING STLS TOP SASL(PLAIN) + +author = "Philip Pickering" +license = "Same as Nmap--See https://nmap.org/book/man-legal.html" + +categories = {"default","discovery","safe"} + + +portrule = shortport.port_or_service({110,995},{"pop3","pop3s"}) + +action = function(host, port) + local capa, err = pop3.capabilities(host, port) + if type(capa) == "table" then + -- Convert the capabilities table into an array of strings. + local capstrings = {} + for cap, args in pairs(capa) do + if ( #args > 0 ) then + table.insert(capstrings, ("%s(%s)"):format(cap, table.concat(args, " "))) + else + table.insert(capstrings, cap) + end + end + return table.concat(capstrings, " ") + elseif type(err) == "string" then + stdnse.debug1("'%s' for %s", err, host.ip) + return + else + return "server doesn't support CAPA" + end +end |