Skip to content

Commit 98d7b19

Browse files
committed
Passed IP parameter to additional functions.
1 parent acff0fa commit 98d7b19

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

modules/auxiliary/scanner/http/http_put.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def initialize
5454
# Send a normal HTTP request and see if we successfully uploaded or deleted a file.
5555
# If successful, return true, otherwise false.
5656
#
57-
def file_exists(path, data)
57+
def file_exists(path, data, ip)
5858
begin
5959
res = send_request_cgi(
6060
{
@@ -75,7 +75,7 @@ def file_exists(path, data)
7575
#
7676
# Do a PUT request to the server. Function returns the HTTP response.
7777
#
78-
def do_put(path, data)
78+
def do_put(path, data, ip)
7979
begin
8080
res = send_request_cgi(
8181
{
@@ -96,7 +96,7 @@ def do_put(path, data)
9696
#
9797
# Do a DELETE request. Function returns the HTTP response.
9898
#
99-
def do_delete(path)
99+
def do_delete(path, ip)
100100
begin
101101
res = send_request_cgi(
102102
{
@@ -135,11 +135,11 @@ def run_host(ip)
135135
end
136136

137137
# Upload file
138-
res = do_put(path, data)
138+
res = do_put(path, data, ip)
139139
vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
140140

141141
# Check file
142-
if not res.nil? and file_exists(path, data)
142+
if not res.nil? and file_exists(path, data, ip)
143143
turl = "#{(ssl ? 'https' : 'http')}://#{ip}:#{rport}#{path}"
144144
print_good("File uploaded: #{turl}")
145145
report_vuln(
@@ -160,17 +160,17 @@ def run_host(ip)
160160
if path !~ /(.+\.\w+)$/
161161
print_error("You must supply a filename")
162162
return
163-
elsif not file_exists(path, data)
163+
elsif not file_exists(path, data, ip)
164164
print_error("File is already gone. Will not continue DELETE")
165165
return
166166
end
167167

168168
# Delete our file
169-
res = do_delete(path)
169+
res = do_delete(path, ip)
170170
vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
171171

172172
# Check if DELETE was successful
173-
if res.nil? or file_exists(path, data)
173+
if res.nil? or file_exists(path, data, ip)
174174
print_error("#{ip}: DELETE failed. File is still there.")
175175
else
176176
turl = "#{(ssl ? 'https' : 'http')}://#{ip}:#{rport}#{path}"

0 commit comments

Comments
 (0)