Path: blob/master/lib/msf/util/exe/windows/aarch64.rb
57477 views
# -*- coding: binary -*-1module Msf::Util::EXE::Windows::Aarch642include Msf::Util::EXE::Common3include Msf::Util::EXE::Windows::Common45def self.included(base)6base.extend(ClassMethods)7end89module ClassMethods10# Construct a Windows AArch64 PE executable with the given shellcode.11# to_winaarch64pe12#13# @param framework [Msf::Framework] The Metasploit framework instance.14# @param code [String] The shellcode to embed in the executable.15# @param opts [Hash] Additional options.16# @return [String] The constructed PE executable as a binary string.1718def to_winaarch64pe(framework, code, opts = {})19# Use the standard template if not specified by the user.20# This helper finds the full path and stores it in opts[:template].21set_template_default(opts, 'template_aarch64_windows.exe')2223# Read the template directly from the path now stored in the options.24pe = File.read(opts[:template], mode: 'rb')2526# Find the tag and inject the payload27bo = find_payload_tag(pe, 'Invalid Windows AArch64 template: missing "PAYLOAD:" tag')28pe[bo, code.length] = code.dup29pe30end31end3233class << self34include ClassMethods35end36end373839