Prevent constant replies from hanging the scan

git-svn-id: file:///home/svn/framework3/trunk@9509 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-06-13 12:16:30 +00:00
parent f4670b26d0
commit 53acdcc98b
1 changed files with 13 additions and 1 deletions

View File

@ -102,8 +102,20 @@ class Metasploit3 < Msf::Auxiliary
end end
end end
while (r = udp_sock.recvfrom(65535, 3) and r[1]) cnt = 0
del = 10
sts = Time.now.to_i
while (r = udp_sock.recvfrom(65535, del) and r[1])
parse_reply(r) parse_reply(r)
# Prevent an indefinite loop if the targets keep replying
cnt += 1
break if cnt > run_batch_size
# Escape after 15 seconds regardless of batch size
break if ((sts + 15) < Time.now.to_i)
del = 1.0
end end
rescue ::Interrupt rescue ::Interrupt