1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 15:39:03 +00:00

Exit the script cleanly rather than throwing an error when attempting to

receive_bytes() from a portmapper service which fails to respond with data.
This commit is contained in:
jah
2009-08-08 01:51:32 +00:00
parent 860686e001
commit 8341de219a

View File

@@ -52,7 +52,15 @@ action = function(host, port)
local request = bin.pack('>IIIIIIILL',0x80000028,transaction_id,0,2,100000,2,4,0,0)
try(socket:send(request))
local answer = try(socket:receive_bytes(1))
local status, answer = socket:receive_bytes(1)
if not status then
stdnse.print_debug(1, "%s failed to receive a response from %s:%d with error: %s",
filename:match( "[\\/]([^\\/]+)\.nse$" ) or filename,
host.ip, port.number,
answer or "unknown")
socket:close()
return nil
end
local _,offset,header,length,tx_id,msg_type,reply_state,accept_state,value,payload,last_fragment
last_fragment = false; offset = 1; payload = ''