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
|
|
|
|
|
2015-10-06 15:30:52 +00:00
|
|
|
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
|
2015-03-08 02:44:19 +00:00
|
|
|
require 'msfenv'
|
|
|
|
|
|
|
|
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
|
|
|
|
2016-07-05 07:33:45 +00:00
|
|
|
gem 'rex-text'
|
|
|
|
|
2015-03-08 02:44:19 +00:00
|
|
|
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|
|
2015-08-13 16:10:50 +00:00
|
|
|
next if name =~ /generic/
|
|
|
|
mod_inst = framework.payloads.create(name)
|
|
|
|
#mod_inst.datastore.merge!(framework.datastore)
|
|
|
|
next if Msf::Util::PayloadCachedSize.is_cached_size_accurate?(mod_inst)
|
2015-03-09 20:29:58 +00:00
|
|
|
$stdout.puts "[*] Updating the CacheSize for #{mod.file_path}..."
|
2015-08-13 16:10:50 +00:00
|
|
|
Msf::Util::PayloadCachedSize.update_module_cached_size(mod_inst)
|
2015-03-08 02:44:19 +00:00
|
|
|
end
|
|
|
|
|