2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2010-02-10 17:27:40 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Create a zip file with comments!
|
|
|
|
#
|
|
|
|
|
2010-02-11 00:18:37 +00:00
|
|
|
msfbase = __FILE__
|
|
|
|
while File.symlink?(msfbase)
|
2013-08-30 21:28:33 +00:00
|
|
|
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
2010-02-11 00:18:37 +00:00
|
|
|
end
|
|
|
|
inc = File.dirname(msfbase) + '/../../..'
|
|
|
|
$:.unshift(inc)
|
|
|
|
|
|
|
|
require 'rex/zip'
|
2010-02-10 17:27:40 +00:00
|
|
|
|
|
|
|
# example usage
|
2010-02-11 00:18:37 +00:00
|
|
|
zip = Rex::Zip::Archive.new
|
2010-02-10 17:27:40 +00:00
|
|
|
zip.add_file("elite.txt", "A" * 1024, nil, %Q<
|
|
|
|
+---------------+
|
|
|
|
| file comment! |
|
|
|
|
+---------------+
|
|
|
|
>)
|
|
|
|
zip.set_comment(%Q<
|
|
|
|
|
|
|
|
+------------------------------------------+
|
|
|
|
| |
|
|
|
|
| Hello! This is the Zip Archive comment! |
|
|
|
|
| |
|
|
|
|
+------------------------------------------+
|
|
|
|
|
|
|
|
>)
|
|
|
|
zip.save_to("lolz.zip")
|