Class: Msf::Exploit::Remote::HTTP::Kubernetes::Client::ExecChannel

Inherits:
Rex::Proto::Http::WebSocket::Interface::Channel show all
Defined in:
lib/msf/core/exploit/remote/http/kubernetes/client.rb

Instance Attribute Summary collapse

Attributes inherited from Rex::Proto::Http::WebSocket::Interface::Channel

#params

Instance Method Summary collapse

Methods inherited from Rex::Proto::Http::WebSocket::Interface::Channel

#close, #close_write, #closed?, #write

Methods included from Rex::Post::Channel::StreamAbstraction

#read

Constructor Details

#initialize(websocket) ⇒ ExecChannel

Returns a new instance of ExecChannel.



17
18
19
20
21
# File 'lib/msf/core/exploit/remote/http/kubernetes/client.rb', line 17

def initialize(websocket)
  @error = {}

  super(websocket, write_type: :text)
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



15
16
17
# File 'lib/msf/core/exploit/remote/http/kubernetes/client.rb', line 15

def error
  @error
end

Instance Method Details

#on_data_read(data, _data_type) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/msf/core/exploit/remote/http/kubernetes/client.rb', line 23

def on_data_read(data, _data_type)
  return data if data.blank?

  exec_channel = data[0].ord
  data = data[1..-1]
  case exec_channel
  when EXEC_CHANNEL_STDOUT
    return data
  when EXEC_CHANNEL_STDERR
    return data
  when EXEC_CHANNEL_ERROR
    @error = JSON(data)
  end

  nil
end

#on_data_write(data) ⇒ Object



40
41
42
# File 'lib/msf/core/exploit/remote/http/kubernetes/client.rb', line 40

def on_data_write(data)
  EXEC_CHANNEL_STDIN.chr + data
end