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/rtsp-methods.nse | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 scripts/rtsp-methods.nse (limited to 'scripts/rtsp-methods.nse') diff --git a/scripts/rtsp-methods.nse b/scripts/rtsp-methods.nse new file mode 100644 index 0000000..e7db1ca --- /dev/null +++ b/scripts/rtsp-methods.nse @@ -0,0 +1,58 @@ +local rtsp = require "rtsp" +local shortport = require "shortport" +local stdnse = require "stdnse" +local stringaux = require "stringaux" + +description = [[ +Determines which methods are supported by the RTSP (real time streaming protocol) server. +]] + +--- +-- @usage +-- nmap -p 554 --script rtsp-methods +-- +-- @output +-- PORT STATE SERVICE +-- 554/tcp open rtsp +-- | rtsp-methods: +-- |_ DESCRIBE, SETUP, PLAY, TEARDOWN, OPTIONS +-- +-- @xmloutput +-- DESCRIBE +-- SETUP +-- PLAY +-- TEARDOWN +-- OPTIONS +-- +-- @args rtsp-methods.path the path to query, defaults to "*" which queries +-- the server itself, rather than a specific url. +-- + +-- +-- Version 0.1 +-- Created 23/10/2011 - v0.1 - created by Patrik Karlsson +-- +author = "Patrik Karlsson" +license = "Same as Nmap--See https://nmap.org/book/man-legal.html" +categories = {"default", "safe"} + + +portrule = shortport.port_or_service(554, "rtsp", "tcp", "open") + +action = function(host, port) + local path = stdnse.get_script_args('rtsp-methods.path') or '*' + local helper = rtsp.Helper:new(host, port) + local status = helper:connect() + if ( not(status) ) then + stdnse.debug2("ERROR: Failed to connect to RTSP server") + return + end + + local response + status, response = helper:options(path) + helper:close() + if ( status ) then + local opts = response.headers['Public'] + return stringaux.strsplit(",%s*", opts), opts + end +end -- cgit v1.2.3