Module: Msf::Util::EXE::Windows::ClassMethods

Included in:
Msf::Util::EXE::Windows
Defined in:
lib/msf/util/exe/windows.rb

Instance Method Summary collapse

Instance Method Details

#to_executable_windows(framework, arch, code, fmt = 'exe', opts = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/msf/util/exe/windows.rb', line 14

def to_executable_windows(framework, arch, code, fmt = 'exe', opts = {})
  exe_formats = ['exe', 'exe-service', 'dll', 'dll-dccw-gdiplus']

  exe_fmt ||= 'exe-small' if ['vba-exe', 'vbs', 'loop-vbs', 'asp', 'aspx-exe'].include?(fmt)
  exe_fmt = 'exe'

  exe_fmt = fmt if exe_formats.include?(fmt)

  exe = nil
  exe = to_executable_windows_x86(framework, code, exe_fmt, opts) if arch.index(ARCH_X86)
  exe = to_executable_windows_x64(framework, code, exe_fmt, opts) if arch.index(ARCH_X64) 
  exe = to_executable_windows_aarch64(framework, code, exe_fmt, opts) if arch.index(ARCH_AARCH64) 
  return exe if exe_formats.include?(fmt) # Returning only the exe
end

#to_executable_windows_aarch64(framework, code, fmt = 'exe', opts = {}) ⇒ Object



29
30
31
# File 'lib/msf/util/exe/windows.rb', line 29

def to_executable_windows_aarch64(framework, code, fmt = 'exe', opts = {})
  return to_winaarch64pe(framework, code, opts) if fmt == 'exe'
end

#to_executable_windows_x64(framework, code, fmt = 'exe', opts = {}) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/msf/util/exe/windows.rb', line 33

def to_executable_windows_x64(framework, code, fmt = 'exe', opts = {})
  return to_win64pe(framework, code, opts) if fmt == 'exe'
  return to_win64pe(framework, code, opts) if fmt == 'exe-small'
  return to_win64pe_service(framework, code, opts) if fmt == 'exe-service'
  return to_win64pe_dll(framework, code, opts) if fmt == 'dll'
  return to_win64pe_dccw_gdiplus_dll(framework, code, opts) if fmt == 'dll-dccw-gdiplus'
end

#to_executable_windows_x86(framework, code, fmt = 'exe', opts = {}) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/msf/util/exe/windows.rb', line 41

def to_executable_windows_x86(framework, code, fmt = 'exe', opts = {})
  return to_win32pe(framework, code, opts) if fmt == 'exe'
  return to_win32pe_service(framework, code, opts) if fmt == 'exe-servsice'
  return to_win32pe_dll(framework, code, opts) if fmt == 'dll'
  return to_winpe_only(framework, code, opts, ARCH_X86) if fmt == 'exe-only'
  return to_win32pe_old(framework, code, opts) if fmt == 'exe-small'
end