Module: Rex::IO::StreamAbstraction
- Included in:
- Post::Meterpreter::Channels::Pools::StreamPool, Post::Meterpreter::Stream, Ui::Text::Input::Buffer::BufferSock
- Defined in:
- lib/rex/io/stream_abstraction.rb
Overview
This class provides an abstraction to a stream based connection through the use of a streaming socketpair.
Defined Under Namespace
Modules: Ext
Instance Attribute Summary collapse
- 
  
    
      #lsock  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The left side of the stream. 
- 
  
    
      #rsock  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The right side of the stream. 
Instance Method Summary collapse
- 
  
    
      #cleanup_abstraction  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    This method cleans up the abstraction layer. 
- 
  
    
      #close  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Closes both sides of the stream abstraction. 
- 
  
    
      #initialize_abstraction  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    This method creates a streaming socket pair and initializes it. 
- 
  
    
      #localinfo  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Symbolic local information. 
- 
  
    
      #peerinfo  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Symbolic peer information. 
- 
  
    
      #shutdown(how)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Shuts down the local side of the stream abstraction. 
- 
  
    
      #sysread(length)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Low-level read from the local side. 
- 
  
    
      #syswrite(buffer)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Low-level write to the local side. 
Instance Attribute Details
#lsock ⇒ Object
The left side of the stream.
| 115 116 117 | # File 'lib/rex/io/stream_abstraction.rb', line 115 def lsock @lsock end | 
#rsock ⇒ Object
The right side of the stream.
| 119 120 121 | # File 'lib/rex/io/stream_abstraction.rb', line 119 def rsock @rsock end | 
Instance Method Details
#cleanup_abstraction ⇒ Object
This method cleans up the abstraction layer.
| 62 63 64 65 66 67 68 | # File 'lib/rex/io/stream_abstraction.rb', line 62 def cleanup_abstraction self.lsock.close if (self.lsock) self.rsock.close if (self.rsock) self.lsock = nil self.rsock = nil end | 
#close ⇒ Object
Closes both sides of the stream abstraction.
| 94 95 96 | # File 'lib/rex/io/stream_abstraction.rb', line 94 def close cleanup_abstraction end | 
#initialize_abstraction ⇒ Object
This method creates a streaming socket pair and initializes it.
| 50 51 52 53 54 55 56 57 | # File 'lib/rex/io/stream_abstraction.rb', line 50 def initialize_abstraction self.lsock, self.rsock = Rex::Socket.tcp_socket_pair() self.lsock.extend(Rex::IO::Stream) self.lsock.extend(Ext) self.rsock.extend(Rex::IO::Stream) self.monitor_rsock end | 
#localinfo ⇒ Object
Symbolic local information.
| 108 109 110 | # File 'lib/rex/io/stream_abstraction.rb', line 108 def localinfo "Local-side of Pipe" end | 
#peerinfo ⇒ Object
Symbolic peer information.
| 101 102 103 | # File 'lib/rex/io/stream_abstraction.rb', line 101 def peerinfo "Remote-side of Pipe" end | 
#shutdown(how) ⇒ Object
Shuts down the local side of the stream abstraction.
| 87 88 89 | # File 'lib/rex/io/stream_abstraction.rb', line 87 def shutdown(how) lsock.shutdown(how) end | 
#sysread(length) ⇒ Object
Low-level read from the local side.
| 80 81 82 | # File 'lib/rex/io/stream_abstraction.rb', line 80 def sysread(length) lsock.sysread(length) end | 
#syswrite(buffer) ⇒ Object
Low-level write to the local side.
| 73 74 75 | # File 'lib/rex/io/stream_abstraction.rb', line 73 def syswrite(buffer) lsock.syswrite(buffer) end |