Skip to content

Commit beb1cef

Browse files
committed
rescue connection failure for netbios, suggest how to fix it
1 parent ee57c71 commit beb1cef

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

modules/exploits/windows/smb/ms17_010_eternalblue.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,20 @@ def verify_arch
263263
'71710533-beba-4937-8319-b5dbef9ccc36', '1.0'
264264
).first
265265

266-
sock = connect(false,
267-
'RHOST' => rhost,
268-
'RPORT' => 135
269-
)
266+
begin
267+
sock = connect(false,
268+
'RHOST' => rhost,
269+
'RPORT' => 135
270+
)
271+
rescue ::Errno::ECONNRESET,
272+
::Rex::HostUnreachable,
273+
::Rex::ConnectionTimeout,
274+
::Rex::ConnectionRefused => e
275+
print_error(e.to_s)
276+
print_warning('Target arch not detected for target OS')
277+
print_warning('Disable VerifyArch option to proceed manually...')
278+
return false
279+
end
270280

271281
sock.put(pkt)
272282

0 commit comments

Comments
 (0)