Skip to content

Commit fde68ac

Browse files
author
james
committed
Styling changes in wordpress helpers
Changes based on rubocop output
1 parent fdf7149 commit fde68ac

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

lib/msf/core/exploit/http/wordpress/helpers.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ module Msf::Exploit::Remote::HTTP::Wordpress::Helpers
1010
# @param pass [String] Password
1111
# @param redirect URL [String] to redirect after successful login
1212
# @return [Hash] The post data for vars_post Parameter
13-
def wordpress_helper_login_post_data(user, pass, redirect=nil)
13+
def wordpress_helper_login_post_data(user, pass, redirect = nil)
1414
post_data = {
15-
'log' => user.to_s,
16-
'pwd' => pass.to_s,
17-
'redirect_to' => redirect.to_s,
18-
'wp-submit' => 'Login'
15+
'log' => user.to_s,
16+
'pwd' => pass.to_s,
17+
'redirect_to' => redirect.to_s,
18+
'wp-submit' => 'Login'
1919
}
2020
post_data
2121
end
@@ -31,23 +31,23 @@ def wordpress_helper_login_post_data(user, pass, redirect=nil)
3131
# @return [String,nil] The location of the new comment/post, nil on error
3232
def wordpress_helper_post_comment(comment, comment_post_id, login_cookie, author, email, url)
3333
vars_post = {
34-
'comment' => comment,
35-
'submit' => 'Post+Comment',
36-
'comment_post_ID' => comment_post_id.to_s,
37-
'comment_parent' => '0'
34+
'comment' => comment,
35+
'submit' => 'Post+Comment',
36+
'comment_post_ID' => comment_post_id.to_s,
37+
'comment_parent' => '0'
3838
}
3939
vars_post.merge!({
40-
'author' => author,
41-
'email' => email,
42-
'url' => url,
40+
'author' => author,
41+
'email' => email,
42+
'url' => url
4343
}) unless login_cookie
4444

4545
options = {
46-
'uri' => normalize_uri(target_uri.path, 'wp-comments-post.php'),
47-
'method' => 'POST'
46+
'uri' => normalize_uri(target_uri.path, 'wp-comments-post.php'),
47+
'method' => 'POST'
4848
}
49-
options.merge!({'vars_post' => vars_post})
50-
options.merge!({'cookie' => login_cookie}) if login_cookie
49+
options.merge!({ 'vars_post' => vars_post })
50+
options.merge!({ 'cookie' => login_cookie }) if login_cookie
5151
res = send_request_cgi(options)
5252
if res && res.redirect? && res.redirection
5353
return wordpress_helper_parse_location_header(res)
@@ -65,7 +65,7 @@ def wordpress_helper_post_comment(comment, comment_post_id, login_cookie, author
6565
# @param comments_enabled [Boolean] If true try to find a post id with comments enabled, otherwise return the first found
6666
# @param login_cookie [String] A valid login cookie to perform the bruteforce as an authenticated user
6767
# @return [Integer,nil] The post id, nil when nothing found
68-
def wordpress_helper_bruteforce_valid_post_id(range, comments_enabled=false, login_cookie=nil)
68+
def wordpress_helper_bruteforce_valid_post_id(range, comments_enabled = false, login_cookie = nil)
6969
range.each { |id|
7070
vprint_status("Checking POST ID #{id}...") if (id % 100) == 0
7171
body = wordpress_helper_check_post_id(wordpress_url_post(id), comments_enabled, login_cookie)
@@ -81,15 +81,15 @@ def wordpress_helper_bruteforce_valid_post_id(range, comments_enabled=false, log
8181
# @param comments_enabled [Boolean] Check if comments are enabled on this post
8282
# @param login_cookie [String] A valid login cookie to perform the check as an authenticated user
8383
# @return [String,nil] the HTTP response body of the post, nil otherwise
84-
def wordpress_helper_check_post_id(uri, comments_enabled=false, login_cookie=nil)
84+
def wordpress_helper_check_post_id(uri, comments_enabled = false, login_cookie = nil)
8585
options = {
86-
'method' => 'GET',
87-
'uri' => uri
86+
'method' => 'GET',
87+
'uri' => uri
8888
}
89-
options.merge!({'cookie' => login_cookie}) if login_cookie
89+
options.merge!({ 'cookie' => login_cookie }) if login_cookie
9090
res = send_request_cgi(options)
9191
# post exists
92-
if res and res.code == 200
92+
if res && res.code == 200
9393
# also check if comments are enabled
9494
if comments_enabled
9595
if res.body =~ /form.*action.*wp-comments-post\.php/

0 commit comments

Comments
 (0)