2005-04-10 01:17:19 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
require 'socket'
|
|
|
|
require 'Rex/Post/Meterpreter/Packet'
|
|
|
|
require 'Rex/Post/Meterpreter/PacketParser'
|
2005-04-10 02:05:43 +00:00
|
|
|
require 'Rex/Post/Meterpreter/PacketDispatcher'
|
2005-04-10 01:17:19 +00:00
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Post
|
|
|
|
module Meterpreter
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Client
|
|
|
|
# ------
|
|
|
|
#
|
|
|
|
# The logical meterpreter client class. This class manages a single session
|
|
|
|
# with a meterpreter server instance.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Client
|
|
|
|
|
2005-04-10 02:05:43 +00:00
|
|
|
include Rex::Post::Meterpreter::PacketDispatcher
|
|
|
|
|
2005-04-10 01:17:19 +00:00
|
|
|
def initialize(sock)
|
|
|
|
self.sock = sock
|
|
|
|
self.parser = PacketParser.new
|
|
|
|
|
|
|
|
monitor_socket
|
|
|
|
end
|
|
|
|
|
|
|
|
def brand(klass)
|
|
|
|
klass = klass.dup
|
|
|
|
klass.client = self
|
|
|
|
return klass
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Packet transmission/reception
|
|
|
|
#
|
|
|
|
|
|
|
|
protected
|
|
|
|
attr_accessor :sock, :parser
|
|
|
|
end
|
|
|
|
|
|
|
|
end; end; end
|