Files
metasploit-gs/tools/exploit/exe2vbs.rb
T

48 lines
803 B
Ruby
Raw Normal View History

2009-07-22 18:43:26 +00:00
#!/usr/bin/env ruby
#
2010-05-03 17:13:09 +00:00
# $Id$
#
2009-07-22 18:43:26 +00:00
# This script converts an EXE to a vbs script
#
2010-05-03 17:13:09 +00:00
# $Revision$
#
2009-07-22 18:43:26 +00:00
msfbase = __FILE__
while File.symlink?(msfbase)
2013-09-30 13:47:53 -05:00
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
2015-10-06 10:30:52 -05:00
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
2012-04-15 23:35:38 -05:00
require 'msfenv'
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
2009-07-22 18:43:26 +00:00
require 'rex'
require 'msf/base'
def usage
2013-09-30 13:47:53 -05:00
$stderr.puts(" Usage: #{$0} [exe] [vbs]\n")
exit
2009-07-22 18:43:26 +00:00
end
exe = ARGV.shift
vbs = ARGV.shift
if (not (exe and vbs))
2013-09-30 13:47:53 -05:00
usage
2009-07-22 18:43:26 +00:00
end
out = File.new(vbs, "w")
inp = File.open(exe, "rb")
dat = ""
while(buf = inp.read(8192))
2013-09-30 13:47:53 -05:00
dat << buf
2009-07-22 18:43:26 +00:00
end
out.write(Msf::Util::EXE.to_exe_vbs(dat))
out.close
inp.close
$stderr.puts "[*] Converted #{dat.length} bytes of EXE into a vbs script"