From 0d47952611198ef6b1163f366dc03922d20b1475 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 09:42:04 +0200 Subject: Adding upstream version 7.94+git20230807.3be01efb1+dfsg. Signed-off-by: Daniel Baumann --- scripts/amqp-info.nse | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 scripts/amqp-info.nse (limited to 'scripts/amqp-info.nse') diff --git a/scripts/amqp-info.nse b/scripts/amqp-info.nse new file mode 100644 index 0000000..d0d299f --- /dev/null +++ b/scripts/amqp-info.nse @@ -0,0 +1,60 @@ +local amqp = require "amqp" +local nmap = require "nmap" +local shortport = require "shortport" +local stdnse = require "stdnse" + +description = [[ +Gathers information (a list of all server properties) from an AMQP (advanced message queuing protocol) server. + +See http://www.rabbitmq.com/extensions.html for details on the +server-properties field. +]] + +--- +-- @usage +-- nmap --script amqp-info -p5672 +--- +-- @output +-- 5672/tcp open amqp +-- | amqp-info: +-- | capabilities: +-- | publisher_confirms: YES +-- | exchange_exchange_bindings: YES +-- | basic.nack: YES +-- | consumer_cancel_notify: YES +-- | copyright: Copyright (C) 2007-2011 VMware, Inc. +-- | information: Licensed under the MPL. See http://www.rabbitmq.com/ +-- | platform: Erlang/OTP +-- | product: RabbitMQ +-- | version: 2.4.0 +-- | mechanisms: PLAIN AMQPLAIN +-- |_ locales: en_US + +author = "Sebastian Dragomir" + +license = "Same as Nmap--See https://nmap.org/book/man-legal.html" + +categories = {"default", "discovery", "safe", "version"} + + +portrule = shortport.version_port_or_service(5672, "amqp", "tcp", "open") + +action = function(host, port) + local cli = amqp.AMQP:new( host, port ) + + local status, data = cli:connect() + if not status then return "Unable to open connection: " .. data end + + status, data = cli:handshake() + if not status then return data end + + cli:disconnect() + + port.version.name = "amqp" + port.version.product = cli:getServerProduct() + port.version.extrainfo = cli:getProtocolVersion() + port.version.version = cli:getServerVersion() + nmap.set_port_version(host, port) + + return stdnse.format_output(status, cli:getServerProperties()) +end -- cgit v1.2.3