Module: Rex::IO::SocketAbstraction
- Included in:
- DatagramAbstraction, StreamAbstraction
- Defined in:
- lib/rex/io/socket_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, MonitoredRSock
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
Override this method to init the abstraction.
-
#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.
111 112 113 |
# File 'lib/rex/io/socket_abstraction.rb', line 111 def lsock @lsock end |
#rsock ⇒ Object
The right side of the stream.
115 116 117 |
# File 'lib/rex/io/socket_abstraction.rb', line 115 def rsock @rsock end |
Instance Method Details
#cleanup_abstraction ⇒ Object
This method cleans up the abstraction layer.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rex/io/socket_abstraction.rb', line 54 def cleanup_abstraction lsock.close if lsock and !lsock.closed? monitor_thread.join if monitor_thread&.alive? rsock.close if rsock and !rsock.closed? self.lsock = nil self.rsock = nil end |
#close ⇒ Object
Closes both sides of the stream abstraction.
89 90 91 92 |
# File 'lib/rex/io/socket_abstraction.rb', line 89 def close cleanup_abstraction super end |
#initialize_abstraction ⇒ Object
Override this method to init the abstraction
47 48 49 |
# File 'lib/rex/io/socket_abstraction.rb', line 47 def initialize_abstraction self.lsock, self.rsock = Rex::Compat.pipe end |
#localinfo ⇒ Object
Symbolic local information.
104 105 106 |
# File 'lib/rex/io/socket_abstraction.rb', line 104 def localinfo 'Local-side of Pipe' end |
#peerinfo ⇒ Object
Symbolic peer information.
97 98 99 |
# File 'lib/rex/io/socket_abstraction.rb', line 97 def peerinfo 'Remote-side of Pipe' end |
#shutdown(how) ⇒ Object
Shuts down the local side of the stream abstraction.
82 83 84 |
# File 'lib/rex/io/socket_abstraction.rb', line 82 def shutdown(how) lsock.shutdown(how) end |
#sysread(length) ⇒ Object
Low-level read from the local side.
75 76 77 |
# File 'lib/rex/io/socket_abstraction.rb', line 75 def sysread(length) lsock.sysread(length) end |
#syswrite(buffer) ⇒ Object
Low-level write to the local side.
68 69 70 |
# File 'lib/rex/io/socket_abstraction.rb', line 68 def syswrite(buffer) lsock.syswrite(buffer) end |