Merge pull request #3 from Meatballs1/psh_fix

Really fix war
bug/bundler_fix
shellster 2013-08-25 08:57:25 -07:00
commit 0a6ac04a0c
3 changed files with 11 additions and 4 deletions

View File

@ -1061,7 +1061,7 @@ def self.to_vba(framework,code,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)

View File

@ -21,6 +21,10 @@ class Archive
#
# 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
@ -32,7 +36,10 @@ class Archive
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)

View File

@ -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