Module: Msf::Exploit::Remote::HTTP::Splunk::Login
- Included in:
- Msf::Exploit::Remote::HTTP::Splunk
- Defined in:
- lib/msf/core/exploit/remote/http/splunk/login.rb
Overview
Module with Splunk login related methods
Instance Method Summary collapse
-
#splunk_default_creds ⇒ Array?
Return the default credentials if found.
-
#splunk_is_auth_required? ⇒ Boolean
The free version of Splunk does not require authentication.
-
#splunk_login(username, password, timeout = 20) ⇒ String?
performs a splunk login.
-
#splunk_login_with_default_creds ⇒ String?
Extract and test the default credentials, if found.
Instance Method Details
#splunk_default_creds ⇒ Array?
Return the default credentials if found
64 65 66 67 68 69 |
# File 'lib/msf/core/exploit/remote/http/splunk/login.rb', line 64 def splunk_default_creds p = %r{Splunk's default credentials are </p><p>username: <span>(.+)</span><br />password: <span>(.+)</span>} res = send_request_raw({ 'uri' => target_uri.path }) user, pass = res.body.scan(p).flatten return [user, pass] if user && pass end |
#splunk_is_auth_required? ⇒ Boolean
The free version of Splunk does not require authentication. Instead, it’ll log the user right in as ‘admin’. If that’s the case, no point to brute-force, either.
51 52 53 54 55 56 57 58 59 |
# File 'lib/msf/core/exploit/remote/http/splunk/login.rb', line 51 def splunk_is_auth_required? = splunk_helper_extract_token res = send_request_raw({ 'uri' => splunk_home, 'cookie' => }) !(res && res.body =~ /Logged in as (.+)/) end |
#splunk_login(username, password, timeout = 20) ⇒ String?
performs a splunk login
11 12 13 14 15 16 17 18 19 20 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 |
# File 'lib/msf/core/exploit/remote/http/splunk/login.rb', line 11 def splunk_login(username, password, timeout = 20) # gets cval cookies = splunk_helper_extract_token(timeout) if .nil? vprint_error('Unable to extract login tokens') return nil end cval_value = .match(/cval=([^;]*)/)[1] # login post, should get back the splunkd_port and splunkweb_csrf_token_port cookies res = send_request_cgi({ 'uri' => splunk_url_login, 'method' => 'POST', 'cookie' => , 'vars_post' => { 'username' => username, 'password' => password, 'cval' => cval_value } }, timeout) unless res vprint_error("FAILED LOGIN. '#{username}' : '#{password}' returned no response") return nil end unless res.code == 303 || (res.code == 200 && res.body.to_s.index('{"status":0}')) vprint_error("FAILED LOGIN. '#{username}' : '#{password}' with code #{res.code}") return nil end print_good("SUCCESSFUL LOGIN. '#{username}' : '#{password}'") return << " #{res.}" end |
#splunk_login_with_default_creds ⇒ String?
Extract and test the default credentials, if found
74 75 76 77 |
# File 'lib/msf/core/exploit/remote/http/splunk/login.rb', line 74 def splunk_login_with_default_creds user, pass = splunk_default_creds splunk_login(user, pass) if user && pass end |