Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/util/exe/osx/x64.rb
57477 views
1
# -*- coding: binary -*-
2
module Msf::Util::EXE::OSX::X64
3
include Msf::Util::EXE::Common
4
include Msf::Util::EXE::OSX::Common
5
6
def self.included(base)
7
base.extend(ClassMethods)
8
end
9
10
module ClassMethods
11
# Create an x86_64 OSX Mach-O containing the payload provided in +code+
12
# self.to_osx_x64_macho
13
#
14
# @param framework [Msf::Framework] The framework of you want to use
15
# @param code [String]
16
# @param opts [Hash]
17
# @option [String] :template
18
# @return [String]
19
def to_osx_x64_macho(framework, code, opts = {})
20
set_template_default(opts, "template_x64_darwin.bin")
21
22
macho = self.get_file_contents(opts[:template])
23
bin = self.find_payload_tag(macho,
24
"Invalid Mac OS X x86_64 Mach-O template: missing \"PAYLOAD:\" tag")
25
macho[bin, code.length] = code
26
macho
27
end
28
end
29
class << self
30
include ClassMethods
31
end
32
end
33
34