Path: blob/master/lib/msf/util/exe/windows/aarch64.rb
36043 views
module Msf::Util::EXE::Windows::Aarch641include Msf::Util::EXE::Common2include Msf::Util::EXE::Windows::Common34def self.included(base)5base.extend(ClassMethods)6end78module ClassMethods9# Construct a Windows AArch64 PE executable with the given shellcode.10# to_winaarch64pe11#12# @param framework [Msf::Framework] The Metasploit framework instance.13# @param code [String] The shellcode to embed in the executable.14# @param opts [Hash] Additional options.15# @return [String] The constructed PE executable as a binary string.1617def to_winaarch64pe(framework, code, opts = {})18# Use the standard template if not specified by the user.19# This helper finds the full path and stores it in opts[:template].20set_template_default(opts, 'template_aarch64_windows.exe')2122# Read the template directly from the path now stored in the options.23pe = File.read(opts[:template], mode: 'rb')2425# Find the tag and inject the payload26bo = find_payload_tag(pe, 'Invalid Windows AArch64 template: missing "PAYLOAD:" tag')27pe[bo, code.length] = code.dup28pe29end30end3132class << self33include ClassMethods34end35end363738