CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/auxiliary/etcd.rb
Views: 1904
1
# -*- coding: binary -*-
2
3
4
module Msf
5
module Auxiliary::Etcd
6
TCP_PORT = 2379
7
def initialize(info = {})
8
super
9
10
register_options(
11
[
12
Opt::RPORT(TCP_PORT),
13
OptString.new('TARGETURI', [true, 'base URI of etcd', '/'])
14
]
15
)
16
17
register_autofilter_ports([TCP_PORT])
18
end
19
20
def fingerprint_service(target_uri)
21
res = send_request_raw(
22
'uri' => normalize_uri(target_uri, 'version'),
23
'method' => 'GET'
24
)
25
if res && res.code == 200
26
begin
27
banner = res.get_json_document
28
rescue JSON::ParserError => e
29
print_error("Failed to read JSON from etcd version response: #{e.class} - #{e.message}}")
30
return
31
end
32
elsif res
33
vprint_error("Invalid response #{res.code} for etcd version response")
34
return
35
else
36
vprint_error("No response for etcd version probe")
37
return
38
end
39
40
report_service(
41
host: rhost,
42
port: rport,
43
name: 'etcd',
44
proto: 'tcp',
45
info: banner
46
)
47
banner
48
end
49
end
50
end
51
52