1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-08 07:29:03 +00:00

applied patch from Thomas Buchanan containing bugfixes and some re-factoring

http://seclists.org/nmap-dev/2010/q4/447
This commit is contained in:
patrik
2010-11-19 19:31:50 +00:00
parent 684c7e0229
commit 68643a2946
2 changed files with 107 additions and 76 deletions

View File

@@ -6,6 +6,11 @@ Attempts to extract system information from the UPnP service.
-- @output
-- | upnp-info: System/1.0 UPnP/1.0 IGD/1.0
-- |_ Location: http://192.168.1.1:80/UPnP/IGD.xml
--
-- @args upnp-info.override Controls whether we override the IP address information
-- returned by the UPNP service for the location of the XML
-- file that describes the device. Defaults to true for
-- unicast hosts.
-- 2010-10-05 - add prerule support <patrik@cqure.net>
-- 2010-10-10 - add newtarget support <patrik@cqure.net>
@@ -17,6 +22,7 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "discovery", "safe"}
require("stdnse")
require("shortport")
require("upnp")
@@ -28,7 +34,13 @@ portrule = shortport.portnumber(1900, "udp", {"open", "open|filtered"})
-- Sends UPnP discovery packet to host,
-- and extracts service information from results
action = function(host, port)
local override = stdnse.get_script_args("upnp-info.override")
local helper = upnp.Helper:new( host, port )
if ( override ~= nil ) and ( string.lower(override) == "false" ) then
helper:setOverride( false )
else
helper:setOverride( true )
end
local status, result = helper:queryServices()
if ( status ) then