Class: Msf::Exploit::Remote::HTTP::Beyondtrust::RemoteSupport::WebSocketStream
- Inherits:
-
Object
- Object
- Msf::Exploit::Remote::HTTP::Beyondtrust::RemoteSupport::WebSocketStream
- Defined in:
- lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb
Overview
Uses the framework's RFC 6455 framing; MRS is a byte stream across frames. https://www.rfc-editor.org/rfc/rfc6455.html#section-5.2
Instance Method Summary collapse
- #close ⇒ void
-
#initialize(socket) ⇒ WebSocketStream
constructor
A new instance of WebSocketStream.
-
#line ⇒ String
Line without LF.
-
#read(size) ⇒ String
Received bytes.
- #write(data) ⇒ void
Constructor Details
#initialize(socket) ⇒ WebSocketStream
Returns a new instance of WebSocketStream.
85 86 87 88 |
# File 'lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb', line 85 def initialize(socket) @socket = socket @buffer = String.new(encoding: Encoding::BINARY) end |
Instance Method Details
#close ⇒ void
This method returns an undefined value.
114 115 116 |
# File 'lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb', line 114 def close @socket.close unless @socket.closed? end |
#line ⇒ String
Returns line without LF.
104 105 106 107 108 109 110 111 |
# File 'lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb', line 104 def line until (offset = @buffer.index("\n")) raise ProtocolError, 'Oversized WebSocket handshake line' if @buffer.bytesize > MAX_MESSAGE @buffer << frame end @buffer.slice!(0, offset + 1).delete_suffix("\n") end |
#read(size) ⇒ String
Returns received bytes.
98 99 100 101 |
# File 'lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb', line 98 def read(size) @buffer << frame while @buffer.bytesize < size @buffer.slice!(0, size) end |
#write(data) ⇒ void
This method returns an undefined value.
92 93 94 |
# File 'lib/msf/core/exploit/remote/http/beyondtrust/remote_support.rb', line 92 def write(data) @socket.put_wsbinary(data.b) end |