Skip to content

Commit

Permalink
Merge pull request #3 from Meatballs1/psh_fix
Browse files Browse the repository at this point in the history
Really fix war
  • Loading branch information
shellster committed Aug 25, 2013
2 parents 50dfac9 + 526e504 commit 0a6ac04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/msf/util/exe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ def self.to_war(jsp_raw, opts={})
web_xml.gsub!(/PAYLOAD/, jsp_name)

zip = Rex::Zip::Archive.new
zip.add_file('META-INF/', nil, meta_inf)
zip.add_file('META-INF/', '', meta_inf)
zip.add_file('META-INF/MANIFEST.MF', manifest)
zip.add_file('WEB-INF/', '')
zip.add_file('WEB-INF/web.xml', web_xml)
Expand Down
9 changes: 8 additions & 1 deletion lib/rex/zip/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def initialize(compmeth=CM_DEFLATE)
#
# Create a new Entry and add it to the archive.
#
# If fdata is set, the file is populated with that data
# from the calling method. If fdata is nil, then the
# fs is checked for the file.
#
def add_file(fname, fdata=nil, xtra=nil, comment=nil)
if (not fdata)
begin
Expand All @@ -32,7 +36,10 @@ def add_file(fname, fdata=nil, xtra=nil, comment=nil)
ts = st.mtime
if (st.directory?)
attrs = EFA_ISDIR
fname += '/'
fdata = ''
unless fname[-1,1] == '/'
fname += '/'
end
else
f = File.open(fname, 'rb')
fdata = f.read(f.stat.size)
Expand Down
4 changes: 2 additions & 2 deletions lib/rex/zip/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Entry
attr_reader :data

def initialize(fname, data, compmeth, timestamp=nil, attrs=nil, xtra=nil, comment=nil)
@name = fname.unpack("C*").pack("C*") if fname
@data = data.unpack("C*").pack("C*") if data
@name = fname.unpack("C*").pack("C*")
@data = data.unpack("C*").pack("C*")
@xtra = xtra
@xtra ||= ''
@comment = comment
Expand Down

0 comments on commit 0a6ac04

Please sign in to comment.