metasploit-framework/lib/rex/zip/samples/mkzip.rb

21 lines
401 B
Ruby
Raw Normal View History

#!/usr/bin/env ruby
# -*- coding: binary -*-
#
# Add a file from memory and save it.
#
msfbase = __FILE__
while File.symlink?(msfbase)
2013-08-30 21:28:33 +00:00
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
inc = File.dirname(msfbase) + '/../../..'
$:.unshift(inc)
require 'rex/zip'
# example usage
zip = Rex::Zip::Archive.new
zip.add_file("elite.txt", "A" * 1024)
zip.save_to("lolz.zip")