@@ -54,7 +54,7 @@ def initialize
54
54
# Send a normal HTTP request and see if we successfully uploaded or deleted a file.
55
55
# If successful, return true, otherwise false.
56
56
#
57
- def file_exists ( path , data )
57
+ def file_exists ( path , data , ip )
58
58
begin
59
59
res = send_request_cgi (
60
60
{
@@ -65,7 +65,7 @@ def file_exists(path, data)
65
65
} , 20
66
66
) . to_s
67
67
rescue ::Exception => e
68
- print_error ( "Error: #{ e . to_s } " )
68
+ print_error ( "#{ ip } : Error: #{ e . to_s } " )
69
69
return nil
70
70
end
71
71
@@ -75,7 +75,7 @@ def file_exists(path, data)
75
75
#
76
76
# Do a PUT request to the server. Function returns the HTTP response.
77
77
#
78
- def do_put ( path , data )
78
+ def do_put ( path , data , ip )
79
79
begin
80
80
res = send_request_cgi (
81
81
{
@@ -86,7 +86,7 @@ def do_put(path, data)
86
86
} , 20
87
87
)
88
88
rescue ::Exception => e
89
- print_error ( "Error: #{ e . to_s } " )
89
+ print_error ( "#{ ip } : Error: #{ e . to_s } " )
90
90
return nil
91
91
end
92
92
@@ -96,7 +96,7 @@ def do_put(path, data)
96
96
#
97
97
# Do a DELETE request. Function returns the HTTP response.
98
98
#
99
- def do_delete ( path )
99
+ def do_delete ( path , ip )
100
100
begin
101
101
res = send_request_cgi (
102
102
{
@@ -106,7 +106,7 @@ def do_delete(path)
106
106
} , 20
107
107
)
108
108
rescue ::Exception => e
109
- print_error ( "Error: #{ e . to_s } " )
109
+ print_error ( "#{ ip } : Error: #{ e . to_s } " )
110
110
return nil
111
111
end
112
112
@@ -135,11 +135,11 @@ def run_host(ip)
135
135
end
136
136
137
137
# Upload file
138
- res = do_put ( path , data )
139
- vprint_status ( "Reply: #{ res . code . to_s } " ) if not res . nil?
138
+ res = do_put ( path , data , ip )
139
+ vprint_status ( "#{ ip } : Reply: #{ res . code . to_s } " ) if not res . nil?
140
140
141
141
# Check file
142
- if not res . nil? and file_exists ( path , data )
142
+ if not res . nil? and file_exists ( path , data , ip )
143
143
turl = "#{ ( ssl ? 'https' : 'http' ) } ://#{ ip } :#{ rport } #{ path } "
144
144
print_good ( "File uploaded: #{ turl } " )
145
145
report_vuln (
@@ -152,26 +152,26 @@ def run_host(ip)
152
152
:exploited_at => Time . now . utc
153
153
)
154
154
else
155
- print_error ( "File doesn't seem to exist. The upload probably failed." )
155
+ print_error ( "#{ ip } : File doesn't seem to exist. The upload probably failed." )
156
156
end
157
157
158
158
when 'DELETE'
159
159
# Check file before deleting
160
160
if path !~ /(.+\. \w +)$/
161
161
print_error ( "You must supply a filename" )
162
162
return
163
- elsif not file_exists ( path , data )
163
+ elsif not file_exists ( path , data , ip )
164
164
print_error ( "File is already gone. Will not continue DELETE" )
165
165
return
166
166
end
167
167
168
168
# Delete our file
169
- res = do_delete ( path )
170
- vprint_status ( "Reply: #{ res . code . to_s } " ) if not res . nil?
169
+ res = do_delete ( path , ip )
170
+ vprint_status ( "#{ ip } : Reply: #{ res . code . to_s } " ) if not res . nil?
171
171
172
172
# Check if DELETE was successful
173
- if res . nil? or file_exists ( path , data )
174
- print_error ( "DELETE failed. File is still there." )
173
+ if res . nil? or file_exists ( path , data , ip )
174
+ print_error ( "#{ ip } : DELETE failed. File is still there." )
175
175
else
176
176
turl = "#{ ( ssl ? 'https' : 'http' ) } ://#{ ip } :#{ rport } #{ path } "
177
177
print_good ( "File deleted: #{ turl } " )
0 commit comments