51 lines
1.1 KiB
Ruby
51 lines
1.1 KiB
Ruby
# -*- coding: binary -*-
|
|
|
|
|
|
module Msf
|
|
module Auxiliary::Etcd
|
|
TCP_PORT = 2379
|
|
def initialize(info = {})
|
|
super
|
|
|
|
register_options(
|
|
[
|
|
Opt::RPORT(TCP_PORT),
|
|
OptString.new('TARGETURI', [true, 'base URI of etcd', '/'])
|
|
]
|
|
)
|
|
|
|
register_autofilter_ports([TCP_PORT])
|
|
end
|
|
|
|
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
|
|
end
|
|
end
|