Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/util/exe/osx/ppc.rb
57477 views
1
# -*- coding: binary -*-
2
module Msf::Util::EXE::OSX::Ppc
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 a PPC OSX Mach-O containing the payload provided in +code+
12
# to_osx_ppc_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_ppc_macho(framework, code, opts = {})
20
21
# Allow the user to specify their own template
22
set_template_default(opts, "template_ppc_darwin.bin")
23
24
mo = get_file_contents(opts[:template])
25
bo = find_payload_tag(mo, "Invalid OSX PPC Mach-O template: missing \"PAYLOAD:\" tag")
26
mo[bo, code.length] = code
27
mo
28
end
29
end
30
31
class << self
32
include ClassMethods
33
end
34
end
35
36