Skip to content

Commit 799c225

Browse files
committed
Warn user if a file/permission is being modified during new session
1 parent f1423bf commit 799c225

21 files changed

+36
-24
lines changed

modules/exploits/linux/http/symantec_web_gateway_file_upload.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def check
7070
end
7171

7272
def on_new_session(client)
73+
print_warning("Deleting temp.php")
7374
if client.type == "meterpreter"
7475
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
7576
client.fs.file.rm("temp.php")

modules/exploits/linux/http/webid_converter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def on_new_session(client)
109109
res = client.fs.file.search(nil, "currencies.php", true, -1)
110110
res.each do |hit|
111111
filename = "#{hit['path']}/#{hit['name']}"
112-
print_status("#{peer} - Restoring #{filename}")
112+
print_warning("#{peer} - Restoring #{filename}")
113113
client.fs.file.rm(filename)
114114
fd = client.fs.file.new(filename, "wb")
115115
fd.write(currencies_php)

modules/exploits/multi/http/qdpm_upload_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def on_new_session(cli)
9494
end
9595

9696
@clean_files.each do |f|
97-
print_status("#{@peer} - Removing: #{f}")
97+
print_warning("#{@peer} - Removing: #{f}")
9898
begin
9999
if cli.type == 'meterpreter'
100100
cli.fs.file.rm(f)

modules/exploits/multi/http/struts_code_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def linux_stager
130130

131131
def on_new_session(client)
132132
if target['Platform'] == 'linux'
133-
print_status("Deleting #{@payload_exe} payload file")
133+
print_warning("Deleting #{@payload_exe} payload file")
134134
execute_command("/bin/sh@-c@rm #{@payload_exe}")
135135
else
136136
print_status("Windows does not allow running executables to be deleted")

modules/exploits/multi/http/struts_code_exec_exception_delegator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def on_new_session(client)
182182
return
183183
end
184184

185-
print_status("Deleting the #{@payload_exe} file")
185+
print_warning("Deleting the #{@payload_exe} file")
186186
client.fs.file.rm(@payload_exe)
187187

188188
end

modules/exploits/multi/http/testlink_upload_exec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def login(base, user, pass)
140140
end
141141

142142
def on_new_session(client)
143+
print_warning("Deleting #{@token}.php")
143144
if client.type == "meterpreter"
144145
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
145146
client.fs.file.rm("#{@token}.php")

modules/exploits/multi/http/webpagetest_upload_exec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,14 @@ def on_new_session(cli)
8080
return
8181
end
8282
cli.core.use("stdapi") if not cli.ext.aliases.include?("stdapi")
83-
cli.fs.file.rm(@target_path)
84-
print_status("#{@target_path} removed")
83+
84+
begin
85+
print_warning("Deleting: #{@target_path}")
86+
cli.fs.file.rm(@target_path)
87+
print_good("#{@target_path} removed")
88+
rescue
89+
print_error("Unable to delete: #{@target_path}")
90+
end
8591
end
8692

8793

modules/exploits/unix/webapp/sugarcrm_unserialize_exec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def on_new_session(client)
6565
f = "pathCache.php"
6666
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
6767
begin
68+
print_warning("#{@peer} - Deleting #{f}")
6869
client.fs.file.rm(f)
6970
print_good("#{@peer} - #{f} removed to stay ninja")
7071
rescue

modules/exploits/unix/webapp/tikiwiki_unserialize_exec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def on_new_session(client)
6969
if client.type == "meterpreter"
7070
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
7171
begin
72+
print_warning("#{@peer} - Deleting #{@upload_php}")
7273
client.fs.file.rm(@upload_php)
7374
print_good("#{@peer} - #{@upload_php} removed to stay ninja")
7475
rescue

modules/exploits/unix/webapp/xoda_file_upload.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def check
7474
end
7575

7676
def on_new_session(client)
77+
print_warning("Deleting #{@payload_name}")
7778
if client.type == "meterpreter"
7879
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
7980
client.fs.file.rm(@payload_name)

0 commit comments

Comments
 (0)