2005-04-13 08:19:22 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
require 'Rex/Socket/StreamAbstraction'
|
2005-04-21 06:32:01 +00:00
|
|
|
require 'Rex/Post/Meterpreter/Channel'
|
2005-04-13 08:19:22 +00:00
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Post
|
|
|
|
module Meterpreter
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Stream
|
|
|
|
# ------
|
|
|
|
#
|
|
|
|
# This class represents a channel that is streaming. This means
|
|
|
|
# that sequential data is flowing in either one or both directions.
|
|
|
|
#
|
|
|
|
###
|
2005-04-21 06:32:01 +00:00
|
|
|
class Stream < Rex::Post::Meterpreter::Channel
|
2005-04-13 08:19:22 +00:00
|
|
|
|
|
|
|
include Rex::Socket::StreamAbstraction
|
|
|
|
|
|
|
|
class <<self
|
|
|
|
def cls
|
|
|
|
return CHANNEL_CLASS_STREAM
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
#
|
|
|
|
# Constructor
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
# Passes the initialization information up to the base class
|
|
|
|
def initialize(client, cid, type, flags)
|
|
|
|
super(client, cid, type, flags)
|
2005-04-15 06:23:59 +00:00
|
|
|
|
|
|
|
initialize_abstraction
|
2005-04-13 08:19:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
#
|
2005-04-21 06:32:01 +00:00
|
|
|
# Remote I/O handlers
|
2005-04-13 08:19:22 +00:00
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
def dio_write_handler(packet, data)
|
|
|
|
rsock.write(data)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
end
|
|
|
|
|
|
|
|
def dio_close_handler(packet)
|
|
|
|
rsock.close
|
|
|
|
|
|
|
|
return super(packet)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end; end; end
|