Class: Msf::Exploit::Remote::HTTP::Kubernetes::Output::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/exploit/remote/http/kubernetes/output/json.rb

Overview

Outputs Kubernetes API responses in JSON format

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ JSON

Creates a new `Msf::Exploit::Remote::HTTP::Kubernetes::Output::JSON` instance

Parameters:

  • output (object)

    The original output object with print_line/print_status/etc methods available.


8
9
10
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 8

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly, protected)

Returns the value of attribute output.


52
53
54
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 52

def output
  @output
end

Instance Method Details


38
39
40
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 38

def print_auth(_namespace, auth)
  print_json(auth)
end

26
27
28
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 26

def print_claims(claims)
  print_json(claims)
end

18
19
20
21
22
23
24
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 18

def print_enum_failure(_resource, error)
  if error.is_a?(Msf::Exploit::Remote::HTTP::Kubernetes::Error::ApiError) && error.res
    print_json(error.res.get_json_document)
  else
    output.print_error(error.message)
  end
end

12
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 12

def print_error(*_args); end

14
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 14

def print_good(*_args); end

54
55
56
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 54

def print_json(object)
  output.print_line(JSON.pretty_generate(object))
end

34
35
36
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 34

def print_namespaces(namespaces)
  print_json(namespaces)
end

42
43
44
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 42

def print_pods(_namespace, pods)
  print_json(pods)
end

46
47
48
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 46

def print_secrets(_namespace, pods)
  print_json(pods)
end

16
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 16

def print_status(*_args); end

30
31
32
# File 'lib/msf/core/exploit/remote/http/kubernetes/output/json.rb', line 30

def print_version(version)
  print_json(version)
end