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



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

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



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

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



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

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



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

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