Skip to content

Commit 0a6ac04

Browse files
author
shellster
committed
Merge pull request #3 from Meatballs1/psh_fix
Really fix war
2 parents 50dfac9 + 526e504 commit 0a6ac04

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/msf/util/exe.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def self.to_war(jsp_raw, opts={})
10611061
web_xml.gsub!(/PAYLOAD/, jsp_name)
10621062

10631063
zip = Rex::Zip::Archive.new
1064-
zip.add_file('META-INF/', nil, meta_inf)
1064+
zip.add_file('META-INF/', '', meta_inf)
10651065
zip.add_file('META-INF/MANIFEST.MF', manifest)
10661066
zip.add_file('WEB-INF/', '')
10671067
zip.add_file('WEB-INF/web.xml', web_xml)

lib/rex/zip/archive.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def initialize(compmeth=CM_DEFLATE)
2121
#
2222
# Create a new Entry and add it to the archive.
2323
#
24+
# If fdata is set, the file is populated with that data
25+
# from the calling method. If fdata is nil, then the
26+
# fs is checked for the file.
27+
#
2428
def add_file(fname, fdata=nil, xtra=nil, comment=nil)
2529
if (not fdata)
2630
begin
@@ -32,7 +36,10 @@ def add_file(fname, fdata=nil, xtra=nil, comment=nil)
3236
ts = st.mtime
3337
if (st.directory?)
3438
attrs = EFA_ISDIR
35-
fname += '/'
39+
fdata = ''
40+
unless fname[-1,1] == '/'
41+
fname += '/'
42+
end
3643
else
3744
f = File.open(fname, 'rb')
3845
fdata = f.read(f.stat.size)

lib/rex/zip/entry.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Entry
1212
attr_reader :data
1313

1414
def initialize(fname, data, compmeth, timestamp=nil, attrs=nil, xtra=nil, comment=nil)
15-
@name = fname.unpack("C*").pack("C*") if fname
16-
@data = data.unpack("C*").pack("C*") if data
15+
@name = fname.unpack("C*").pack("C*")
16+
@data = data.unpack("C*").pack("C*")
1717
@xtra = xtra
1818
@xtra ||= ''
1919
@comment = comment

0 commit comments

Comments
 (0)