check if the socket exists before closing
parent
bb684bb3b1
commit
fdca963b61
|
@ -80,8 +80,10 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
'ConnectTimeout' => (timeout / 1000.0)
|
'ConnectTimeout' => (timeout / 1000.0)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print_status("#{ip}:#{port} - TCP OPEN")
|
if s
|
||||||
r << [ip,port,"open"]
|
print_status("#{ip}:#{port} - TCP OPEN")
|
||||||
|
r << [ip,port,"open"]
|
||||||
|
end
|
||||||
rescue ::Rex::ConnectionRefused
|
rescue ::Rex::ConnectionRefused
|
||||||
vprint_status("#{ip}:#{port} - TCP closed")
|
vprint_status("#{ip}:#{port} - TCP closed")
|
||||||
r << [ip,port,"closed"]
|
r << [ip,port,"closed"]
|
||||||
|
@ -92,7 +94,9 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
rescue ::Exception => e
|
rescue ::Exception => e
|
||||||
print_error("#{ip}:#{port} exception #{e.class} #{e} #{e.backtrace}")
|
print_error("#{ip}:#{port} exception #{e.class} #{e} #{e.backtrace}")
|
||||||
ensure
|
ensure
|
||||||
disconnect(s) rescue nil
|
if s
|
||||||
|
disconnect(s) rescue nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue