Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/payloads/adapters/cmd/windows/powershell/x64.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6include Msf::Payload::Adapter7include Msf::Exploit::Powershell89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Powershell Exec',14'Description' => 'Execute an x64 payload from a command via PowerShell',15'Author' => 'Spencer McIntyre',16'Platform' => 'win',17'Arch' => ARCH_CMD,18'License' => MSF_LICENSE,19'AdaptedArch' => ARCH_X64,20'AdaptedPlatform' => 'win',21'RequiredCmd' => 'powershell'22)23)24end2526def compatible?(mod)27# size is not unlimited due to the standard command length limit, the final size depends on the options that are28# configured but 3,000 is in a good range (can go up to 4,000 with default settings at this time)29if mod.type == Msf::MODULE_PAYLOAD && (mod.class.const_defined?(:CachedSize) && mod.class::CachedSize != :dynamic) && (mod.class::CachedSize >= 3_000)30return false31end3233super34end3536def generate(opts = {})37opts[:arch] ||= module_info['AdaptedArch']38payload = super3940cmd_psh_payload(payload, ARCH_X64, remove_comspec: true)41end4243def generate_stage(opts = {})44opts[:arch] ||= module_info['AdaptedArch']45super46end4748def generate_payload_uuid(conf = {})49conf[:arch] ||= module_info['AdaptedArch']50conf[:platform] ||= module_info['AdaptedPlatform']51super52end5354def handle_connection(conn, opts = {})55opts[:arch] ||= module_info['AdaptedArch']56super57end58end596061