Add a second_chance on cmd_use
This is a weak attempt to solve a race condition between modules loading and cmd_use being fired. Upon startup, saved configurations, running resource scripts, and running commands will sometimes jump ahead of the module loading procedure. I have not discovered where the race actually is and how to cause the race to happen. However, the timing seems to be fairly close to a second; by waiting three seconds after trying use again, we seem to be in the clear, at least according to testing. Fixes #4549, but better solutions are welcome!bug/bundler_fix
parent
2cc44cc7c9
commit
63c66f66a0
|
@ -2418,10 +2418,16 @@ class Core
|
|||
mod_name = args[0]
|
||||
|
||||
begin
|
||||
if ((mod = framework.modules.create(mod_name)) == nil)
|
||||
mod = framework.modules.create(mod_name)
|
||||
if mod.nil?
|
||||
# Try one more time; see #4549
|
||||
sleep 3
|
||||
mod = framework.modules.create(mod_name)
|
||||
if mod.nil?
|
||||
print_error("Failed to load module: #{mod_name}")
|
||||
return false
|
||||
end
|
||||
end
|
||||
rescue Rex::AmbiguousArgumentError => info
|
||||
print_error(info.to_s)
|
||||
rescue NameError => info
|
||||
|
|
Loading…
Reference in New Issue