Skip to content

Commit f0428bf

Browse files
committed
Land #16627, Add some error handling to update_payload_cache_size script
2 parents 1c62a3c + 785a176 commit f0428bf

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tools/modules/update_payload_cached_sizes.rb

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,23 @@
2525

2626
# Initialize the simplified framework instance.
2727
framework = Msf::Simple::Framework.create('DisableDatabase' => true)
28-
28+
exceptions = []
2929
framework.payloads.each_module do |name, mod|
30-
next if name =~ /generic/
31-
mod_inst = framework.payloads.create(name)
32-
#mod_inst.datastore.merge!(framework.datastore)
33-
next if Msf::Util::PayloadCachedSize.is_cached_size_accurate?(mod_inst)
34-
$stdout.puts "[*] Updating the CacheSize for #{mod.file_path}..."
35-
Msf::Util::PayloadCachedSize.update_module_cached_size(mod_inst)
30+
begin
31+
next if name =~ /generic/
32+
mod_inst = framework.payloads.create(name)
33+
#mod_inst.datastore.merge!(framework.datastore)
34+
next if Msf::Util::PayloadCachedSize.is_cached_size_accurate?(mod_inst)
35+
$stdout.puts "[*] Updating the CacheSize for #{mod.file_path}..."
36+
Msf::Util::PayloadCachedSize.update_module_cached_size(mod_inst)
37+
rescue => e
38+
exceptions << [ e, name ]
39+
next
40+
end
41+
end
42+
43+
exceptions.each do |e, name|
44+
print_error("Caught Error while updating #{name}:\n#{e}")
45+
elog(e)
3646
end
47+
exit(1) unless exceptions.empty?

0 commit comments

Comments
 (0)