From 7767505678d5a9bcd007a5d5dcff6b6bf773fefa Mon Sep 17 00:00:00 2001 From: Jon Hart Date: Wed, 28 Mar 2018 09:31:50 -0700 Subject: [PATCH] Fix some style issues --- .../scanner/etcd/open_key_scanner.rb | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/modules/auxiliary/scanner/etcd/open_key_scanner.rb b/modules/auxiliary/scanner/etcd/open_key_scanner.rb index 39ca1dac7f..7c24d1e7c3 100644 --- a/modules/auxiliary/scanner/etcd/open_key_scanner.rb +++ b/modules/auxiliary/scanner/etcd/open_key_scanner.rb @@ -11,34 +11,36 @@ class MetasploitModule < Msf::Auxiliary def initialize super( 'Name' => 'Etcd Keys API Information Gathering', - 'Description' => %q{ + 'Description' => %q( This module queries the etcd API to recursively retrieve all of the stored key value pairs. Etcd by default does not utilize authentication. - }, + ), 'References' => [ - ['URL', 'https://elweb.co/the-security-footgun-in-etcd'] - ], + ['URL', 'https://elweb.co/the-security-footgun-in-etcd'] + ], 'Author' => [ - 'Giovanni Collazo ', # discovery - 'h00die' # msf module - ], + 'Giovanni Collazo ', # discovery + 'h00die' # msf module + ], 'License' => MSF_LICENSE ) - register_options([ - Opt::RPORT(2379), - OptString.new('TARGETURI', [ true, 'URI of the vulnerable service', '/']) - ]) + register_options( + [ + Opt::RPORT(2379), + OptString.new('TARGETURI', [true, 'URI of the vulnerable service', '/']) + ] + ) end def run_host(target_host) path = normalize_uri(target_uri.to_s, 'v2/keys/?recursive=true') vprint_status("#{peer} - Collecting data through #{path}...") - res = send_request_raw({ + res = send_request_raw( 'uri' => path, 'method' => 'GET' - }) + ) # parse the json if we got a good request back if res && res.code == 200 @@ -47,22 +49,22 @@ class MetasploitModule < Msf::Auxiliary store_loot('etcd.data', 'text/json', rhost, response, 'etcd.keys', 'etcd keys') # since we know its vulnerable, go ahead and pull the version information - res = send_request_raw({ + res = send_request_raw( 'uri' => normalize_uri(target_uri.to_s, 'version'), 'method' => 'GET' - }) + ) banner = '' if res && res.code == 200 banner = res.body end - report_service({ - :host => rhost, - :port => rport, - :name => 'etcd', - :proto => 'tcp', - :info => banner - }) + report_service( + host: rhost, + port: rport, + name: 'etcd', + proto: 'tcp', + info: banner + ) rescue JSON::ParserError => e print_error("Failed to read JSON: #{e.class} - #{e.message}}") return