Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/util/exe/osx.rb
36037 views
1
module Msf::Util::EXE::OSX
2
include Msf::Util::EXE::Common
3
include Msf::Util::EXE::OSX::Common
4
include Msf::Util::EXE::OSX::X86
5
include Msf::Util::EXE::OSX::X64
6
include Msf::Util::EXE::OSX::Armle
7
include Msf::Util::EXE::OSX::Aarch64
8
9
def self.included(base)
10
base.extend(ClassMethods)
11
end
12
13
module ClassMethods
14
def to_executable_osx(framework, arch, code, fmt = 'macho', opts = {})
15
exe_formats = ['macho', 'app']
16
exe_fmt = 'macho'
17
exe_fmt = fmt if exe_formats.include?(fmt)
18
19
exe = nil
20
exe = to_executable_osx_x86(framework, code, exe_fmt, opts) if arch.index(ARCH_X86)
21
exe = to_executable_osx_x64(framework, code, exe_fmt, opts) if arch.index(ARCH_X64)
22
exe = to_executable_osx_armle(framework, code, exe_fmt, opts) if arch.index(ARCH_ARMLE)
23
exe = to_executable_osx_aarch64(framework, code, exe_fmt, opts) if arch.index(ARCH_AARCH64)
24
exe = to_executable_osx_app(framework, code, exe_fmt, opts) if fmt == 'app'
25
exe = to_executable_osx_ppc(framework, code, exe_fmt, opts) if arch.index(ARCH_PPC)
26
27
return exe if exe_formats.include?(fmt) # Returning only the exe
28
end
29
30
def to_executable_osx_x86(framework, code, fmt = 'macho', opts = {})
31
return to_osx_x86_macho(framework, code, opts) if fmt == 'macho'
32
end
33
34
def to_executable_osx_x64(framework, code, fmt = 'macho', opts = {})
35
return to_osx_x64_macho(framework, code, opts) if fmt == 'macho'
36
end
37
38
def to_executable_osx_armle(framework, code, fmt = 'macho', opts = {})
39
return to_osx_armle_macho(framework, code, opts) if fmt == 'macho'
40
end
41
42
def to_executable_osx_aarch64(framework, code, fmt = 'macho', opts = {})
43
return to_osx_aarch64_macho(framework, code, opts) if fmt == 'macho'
44
end
45
46
def to_executable_osx_app(framework, code, fmt = 'app', opts = {})
47
return to_osx_app(code, opts) if fmt == 'app'
48
end
49
50
def to_executable_osx_ppc(framework, code, fmt = 'macho', opts = {})
51
return to_osx_ppc_macho(framework, code, opts) if fmt == 'macho'
52
end
53
end
54
class << self
55
include ClassMethods
56
end
57
end
58
59