Module: Msf::Auxiliary::Etcd

Defined in:
lib/msf/core/auxiliary/etcd.rb

Constant Summary collapse

TCP_PORT =
2379

Instance Method Summary collapse

Instance Method Details

#fingerprint_service(target_uri) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/msf/core/auxiliary/etcd.rb', line 21

def fingerprint_service(target_uri)
  res = send_request_raw(
    'uri'    => normalize_uri(target_uri, 'version'),
    'method' => 'GET'
  )
  if res && res.code == 200
    begin
      banner = res.get_json_document
    rescue JSON::ParserError => e
      print_error("Failed to read JSON from etcd version response: #{e.class} - #{e.message}}")
      return
    end
  elsif res
    vprint_error("Invalid response #{res.code} for etcd version response")
    return
  else
    vprint_error("No response for etcd version probe")
    return
  end

  report_service(
    host: rhost,
    port: rport,
    name: 'etcd',
    proto: 'tcp',
    info: banner
  )
  banner
end

#initialize(info = {}) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/msf/core/auxiliary/etcd.rb', line 8

def initialize(info = {})
  super

  register_options(
    [
      Opt::RPORT(TCP_PORT),
      OptString.new('TARGETURI', [true, 'base URI of etcd', '/'])
    ]
  )

  register_autofilter_ports([TCP_PORT])
end