2015-03-08 02:44:19 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
#
|
2015-03-09 20:29:58 +00:00
|
|
|
# This script updates the CachedSize constants in payload modules
|
2015-03-08 02:44:19 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
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/ui'
|
|
|
|
require 'msf/base'
|
2015-03-09 20:29:58 +00:00
|
|
|
require 'msf/util/payload_cached_size'
|
2015-03-08 02:44:19 +00:00
|
|
|
|
|
|
|
# Initialize the simplified framework instance.
|
2015-03-09 20:29:58 +00:00
|
|
|
framework = Msf::Simple::Framework.create('DisableDatabase' => true)
|
2015-03-09 18:15:06 +00:00
|
|
|
|
2015-03-09 20:29:58 +00:00
|
|
|
framework.payloads.each_module do |name, mod|
|
|
|
|
next if Msf::Util::PayloadCachedSize.is_cached_size_accurate?(mod)
|
|
|
|
$stdout.puts "[*] Updating the CacheSize for #{mod.file_path}..."
|
|
|
|
Msf::Util::PayloadCachedSize.update_module_cached_size(mod)
|
2015-03-08 02:44:19 +00:00
|
|
|
end
|
|
|
|
|