@@ -153,11 +153,22 @@ def smb_eternalblue(process_name, grooms)
153
153
client , tree , sock , os = smb1_anonymous_connect_ipc ( )
154
154
print_good ( "Connection established for exploitation." )
155
155
156
- if !verify_target ( os )
156
+ if verify_target ( os )
157
+ print_good ( 'Target OS selected valid for OS indicated by SMB reply' )
158
+ else
159
+ print_warning ( 'Target OS selected not valid for OS indicated by SMB reply' )
160
+ print_warning ( 'Disable VerifyTarget option to proceed manually...' )
157
161
raise EternalBlueError , 'Unable to continue with improper OS Target.'
158
162
end
159
163
160
- if !verify_arch
164
+ # cool buffer print no matter what, will be helpful when people post debug issues
165
+ print_core_buffer ( os )
166
+
167
+ if verify_arch
168
+ print_good ( 'Target arch selected valid for arch indicated by DCE/RPC reply' )
169
+ else
170
+ print_warning ( 'Target arch selected not valid for arch indicated by DCE/RPC reply' )
171
+ print_warning ( 'Disable VerifyArch option to proceed manually...' )
161
172
raise EternalBlueError , 'Unable to continue with improper OS Arch.'
162
173
end
163
174
@@ -234,18 +245,8 @@ def verify_target(os)
234
245
break
235
246
end
236
247
end
237
-
238
- if ret
239
- print_good ( 'Target OS selected valid for OS indicated by SMB reply' )
240
- else
241
- print_warning ( 'Target OS selected not valid for OS indicated by SMB reply' )
242
- print_warning ( 'Disable VerifyTarget option to proceed manually...' )
243
- end
244
248
end
245
249
246
- # cool buffer print no matter what, will be helpful when people post debug issues
247
- print_core_buffer ( os )
248
-
249
250
return ret
250
251
end
251
252
@@ -263,10 +264,15 @@ def verify_arch
263
264
'71710533-beba-4937-8319-b5dbef9ccc36' , '1.0'
264
265
) . first
265
266
266
- sock = connect ( false ,
267
- 'RHOST' => rhost ,
268
- 'RPORT' => 135
269
- )
267
+ begin
268
+ sock = connect ( false ,
269
+ 'RHOST' => rhost ,
270
+ 'RPORT' => 135
271
+ )
272
+ rescue Rex ::ConnectionError => e
273
+ print_error ( e . to_s )
274
+ return false
275
+ end
270
276
271
277
sock . put ( pkt )
272
278
@@ -300,13 +306,6 @@ def verify_arch
300
306
end
301
307
end
302
308
303
- if ret
304
- print_good ( 'Target arch selected valid for OS indicated by DCE/RPC reply' )
305
- else
306
- print_warning ( 'Target arch selected not valid for OS indicated by DCE/RPC reply' )
307
- print_warning ( 'Disable VerifyArch option to proceed manually...' )
308
- end
309
-
310
309
ret
311
310
end
312
311
0 commit comments