Sha256: b4f9892f6331542f0d7e82899466ecbcfac01d459393757a7db1899e0aa93cc3

Contents?: true

Size: 1.69 KB

Versions: 43

Compression:

Stored size: 1.69 KB

Contents

#!/usr/bin/env ruby

require 'rex/post/meterpreter/channels/pool'
require 'rex/post/meterpreter/extensions/stdapi/tlv'

module Rex
module Post
module Meterpreter
module Channels
module Pools

###
#
# StreamPool
# ----------
#
# This class represents a channel that is associated with a
# streaming pool that has no definite end-point.  While this
# may seem a paradox given the stream class of channels, it's
# in fact dinstinct because streams automatically forward
# traffic between the two ends of the channel whereas
# stream pools are always requested data in a single direction.
#
###
class StreamPool < Rex::Post::Meterpreter::Channels::Pool

	include Rex::IO::StreamAbstraction

	##
	#
	# Constructor
	#
	##

	# Initializes the file channel instance
	def initialize(client, cid, type, flags)
		super(client, cid, type, flags)

		initialize_abstraction
	end

	##
	#
	# Streaming pools don't support tell, seek, or eof.
	#
	##

	#
	# This method returns the current offset into the pool.
	#
	def tell
		throw NotImplementedError
	end

	#
	# This method seeks to an offset in the pool.
	#
	def seek
		throw NotImplementedError
	end

	#
	# This method returns whether or not eof has been returned.
	#
	def eof
		return false
	end

	#
	# Transfers data to the local half of the pool for reading.
	#
	def dio_write_handler(packet, data)
		rv = Rex::ThreadSafe.select(nil, [rsock], nil, 0.01)
		if(rv)
			rsock.write(data)
			return true
		else
			return false
		end
	end

	#
	# Closes the local half of the pool stream.
	#
	def dio_close_handler(packet)
		rsock.close

		return super(packet)
	end

	#
	# Cleans up resources used by the channel.
	#
	def cleanup
		super

		cleanup_abstraction
	end

end

end; end; end; end; end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.63 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.54 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.53 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.52 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.51 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.50 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.49 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.48 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.47 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.46 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.44 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.43 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.42 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.41 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.40 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.39 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.38 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.37 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.36 lib/rex/post/meterpreter/channels/pools/stream_pool.rb