Path: blob/master/lib/msf/util/exe/windows.rb
36037 views
module Msf::Util::EXE::Windows1include Msf::Util::EXE::Common2include Msf::Util::EXE::Windows::Common3include Msf::Util::EXE::Windows::Aarch644include Msf::Util::EXE::Windows::X645include Msf::Util::EXE::Windows::X8667def self.included(base)8base.extend(ClassMethods)9end1011module ClassMethods1213def to_executable_windows(framework, arch, code, fmt = 'exe', opts = {})14exe_formats = ['exe', 'exe-service', 'dll', 'dll-dccw-gdiplus']1516exe_fmt ||= 'exe-small' if ['vba-exe', 'vbs', 'loop-vbs', 'asp', 'aspx-exe'].include?(fmt)17exe_fmt = 'exe'1819exe_fmt = fmt if exe_formats.include?(fmt)2021exe = nil22exe = to_executable_windows_x86(framework, code, exe_fmt, opts) if arch.index(ARCH_X86)23exe = to_executable_windows_x64(framework, code, exe_fmt, opts) if arch.index(ARCH_X64)24exe = to_executable_windows_aarch64(framework, code, exe_fmt, opts) if arch.index(ARCH_AARCH64)25return exe if exe_formats.include?(fmt) # Returning only the exe26end2728def to_executable_windows_aarch64(framework, code, fmt = 'exe', opts = {})29return to_winaarch64pe(framework, code, opts) if fmt == 'exe'30end3132def to_executable_windows_x64(framework, code, fmt = 'exe', opts = {})33return to_win64pe(framework, code, opts) if fmt == 'exe'34return to_win64pe(framework, code, opts) if fmt == 'exe-small'35return to_win64pe_service(framework, code, opts) if fmt == 'exe-service'36return to_win64pe_dll(framework, code, opts) if fmt == 'dll'37return to_win64pe_dccw_gdiplus_dll(framework, code, opts) if fmt == 'dll-dccw-gdiplus'38end3940def to_executable_windows_x86(framework, code, fmt = 'exe', opts = {})41return to_win32pe(framework, code, opts) if fmt == 'exe'42return to_win32pe_service(framework, code, opts) if fmt == 'exe-servsice'43return to_win32pe_dll(framework, code, opts) if fmt == 'dll'44return to_winpe_only(framework, code, opts, ARCH_X86) if fmt == 'exe-only'45return to_win32pe_old(framework, code, opts) if fmt == 'exe-small'46end47end4849class << self50include ClassMethods51end52end535455