Handle modules failing to be created when checking compatibility

This commit is contained in:
dwelch-r7 2021-03-10 14:36:38 +00:00
parent 17ef194c52
commit 5f1916072c
2 changed files with 13 additions and 2 deletions

View File

@ -710,7 +710,12 @@ class Exploit < Msf::Module
# Skip over payloads that are too big
return false if payload_space && p.cached_size && p.cached_size > payload_space
pi = p.new
begin
pi = p.new
rescue ::Exception, ::LoadError => e
wlog("Module #{name} failed to initialize: #{e}", 'core', LEV_0)
return false
end
# Are we compatible in terms of conventions and connections and
# what not?

View File

@ -346,7 +346,13 @@ def dump_payloads(platform = nil, arch = nil)
framework.payloads.each_module(
'Platform' => platform ? Msf::Module::PlatformList.transform(platform.split(',')) : nil,
'Arch' => arch ? arch.split(',') : nil) do |name, mod|
tbl << [ name, mod.new.description.split.join(' ') ]
begin
mod_info = mod.new.description.split.join(' ')
rescue ::Exception, ::LoadError => e
wlog("Module #{name} failed to initialize: #{e}", 'core', LEV_0)
next
end
tbl << [ name, mod_info ]
end
"\n" + tbl.to_s + "\n"