Sha256: 9128c65b230906d23960477157802ae3863d460af34605410ffde90894f194a4

Contents?: true

Size: 1.77 KB

Versions: 15

Compression:

Stored size: 1.77 KB

Contents

# -*- coding: binary -*-

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
    raise NotImplementedError
  end

  #
  # This method seeks to an offset in the pool.
  #
  def seek
    raise 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

15 entries across 15 versions & 3 rubygems

Version Path
rex-2.0.13 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.12 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.11 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.10 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.9 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.8 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.7 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.5 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.4 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
dstruct-0.0.1 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.3 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.999 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
rex-2.0.2 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.71 lib/rex/post/meterpreter/channels/pools/stream_pool.rb
librex-0.0.70 lib/rex/post/meterpreter/channels/pools/stream_pool.rb