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.
unstable
OJ 2015-05-12 09:05:58 +10:00
parent fe51f552b8
commit 42f94e70c7
2 changed files with 5 additions and 7 deletions

View File

@ -34,10 +34,12 @@ module Msf::Payload::Windows
#
@@exit_types =
{
nil => 0, # Default to nothing
'' => 0, # Default to nothing
'seh' => 0xEA320EFE, # SetUnhandledExceptionFilter
'thread' => 0x0A2A1DE0, # ExitThread
'process' => 0x56A2B5F0, # ExitProcess
'none' => 0x5DE2C5AA, # GetLastError
'none' => 0x5DE2C5AA # GetLastError
}
#

View File

@ -49,11 +49,7 @@ private
def session_block(opts)
uuid = to_str(opts[:uuid].to_raw, UUID_SIZE)
if opts[:exitfunk]
exit_func = Msf::Payload::Windows.exit_types[opts[:exitfunk]]
else
exit_func = 0
end
exit_func = Msf::Payload::Windows.exit_types[opts[:exitfunk]]
session_data = [
0, # comms socket, patched in by the stager
@ -74,8 +70,8 @@ private
end
url = "#{opts[:scheme]}://#{lhost}:#{opts[:lport]}"
url << "?#{opts[:scope_id]}" if opts[:scope_id]
url << "#{opts[:uri]}/" if opts[:uri]
url << "?#{opts[:scope_id]}" if opts[:scope_id]
# if the transport URI is for a HTTP payload we need to add a stack
# of other stuff