1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 09:29:01 +00:00

Added support for returning multiple responses to the srvloc library

This commit is contained in:
patrik
2012-03-08 17:34:43 +00:00
parent 480784d252
commit 03dde2cc9a
2 changed files with 21 additions and 8 deletions

View File

@@ -324,15 +324,19 @@ Helper = {
self.socket:set_timeout(5000)
self.socket:sendto( self.host, self.port, tostring(sr) )
local r = Reply.Service.fromSocket(self.socket)
self.socket:close()
local result = {}
repeat
local r = Reply.Service.fromSocket(self.socket)
if ( r ) then
table.insert(result, r:getUrl())
end
self.xid = self.xid + 1
until(not(r))
self.xid = self.xid + 1
if ( not(r) ) then
if ( #result == 0 ) then
return false, "ERROR: Helper.Locate no response received"
end
return true, r:getUrl()
return true, result
end,
--- Requests an attribute from the server
@@ -355,7 +359,6 @@ Helper = {
self.socket:sendto( self.host, self.port, tostring(ar) )
local r = Reply.Attribute.fromSocket(self.socket)
self.socket:close()
self.xid = self.xid + 1
if ( not(r) ) then
@@ -364,4 +367,8 @@ Helper = {
return true, r:getAttribList()
end,
close = function(self)
return self.socket:close()
end,
}