1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-16 01:21:15 +02:00
metasploit-framework/tools/exe2vbs.rb
Luke Imhoff b863978028
Remove fastlib
MSP-11368
MSP-11143

Remove fastlib as it slows down the code loading process.  From the
previous commit, the mean loading for
`METASPLOIT_FRAMEWORK_PROFILE=true msfconsole -q -x exit` was
27.9530±0.3485 seconds (N=10).  The mean after removal of fastlib
was 17.9820±0.6497 seconds (N=10).  This means an average 35.67%
reduction in boot time.
2014-09-18 15:24:21 -05:00

48 lines
797 B
Ruby
Executable File

#!/usr/bin/env ruby
#
# $Id$
#
# This script converts an EXE to a vbs script
#
# $Revision$
#
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
require 'msfenv'
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
require 'rex'
require 'msf/base'
def usage
$stderr.puts(" Usage: #{$0} [exe] [vbs]\n")
exit
end
exe = ARGV.shift
vbs = ARGV.shift
if (not (exe and vbs))
usage
end
out = File.new(vbs, "w")
inp = File.open(exe, "rb")
dat = ""
while(buf = inp.read(8192))
dat << buf
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"