Skip to content

Commit 42f94e7

Browse files
committed
Add nil default to exit_types, transport param order swap
This allows for checking against exit types to be super easy instead of having to have extra checks in place. Also changed the order of scope_id and uri in the transport URI generation. The net effect of this is NOP because these things only appear separately.
1 parent fe51f55 commit 42f94e7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/msf/core/payload/windows.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ module Msf::Payload::Windows
3434
#
3535
@@exit_types =
3636
{
37+
nil => 0, # Default to nothing
38+
'' => 0, # Default to nothing
3739
'seh' => 0xEA320EFE, # SetUnhandledExceptionFilter
3840
'thread' => 0x0A2A1DE0, # ExitThread
3941
'process' => 0x56A2B5F0, # ExitProcess
40-
'none' => 0x5DE2C5AA, # GetLastError
42+
'none' => 0x5DE2C5AA # GetLastError
4143
}
4244

4345
#

lib/rex/payloads/meterpreter/config.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ def to_ascii(item, size)
4949

5050
def session_block(opts)
5151
uuid = to_str(opts[:uuid].to_raw, UUID_SIZE)
52-
if opts[:exitfunk]
53-
exit_func = Msf::Payload::Windows.exit_types[opts[:exitfunk]]
54-
else
55-
exit_func = 0
56-
end
52+
exit_func = Msf::Payload::Windows.exit_types[opts[:exitfunk]]
5753

5854
session_data = [
5955
0, # comms socket, patched in by the stager
@@ -74,8 +70,8 @@ def transport_block(opts)
7470
end
7571

7672
url = "#{opts[:scheme]}://#{lhost}:#{opts[:lport]}"
77-
url << "?#{opts[:scope_id]}" if opts[:scope_id]
7873
url << "#{opts[:uri]}/" if opts[:uri]
74+
url << "?#{opts[:scope_id]}" if opts[:scope_id]
7975

8076
# if the transport URI is for a HTTP payload we need to add a stack
8177
# of other stuff

0 commit comments

Comments
 (0)