Maintain module config after reload from load_modules
This commit is contained in:
parent
ef7b5cfc74
commit
f152c9df50
|
@ -971,8 +971,21 @@ class Manager:
|
|||
|
||||
# Update the current module context if we just replaced a module
|
||||
if old_module != new_module and self.config.module == old_module:
|
||||
# Save the local configuration for the module
|
||||
config = self.config.locals
|
||||
# Use the new module
|
||||
self.config.use(new_module)
|
||||
|
||||
# Attempt to re-set any configuration items previously set
|
||||
# This could fail if the argument definitions changed on disk.
|
||||
for key, value in config.items():
|
||||
try:
|
||||
self.config.set(key, value)
|
||||
except ValueError as exc:
|
||||
self.log(
|
||||
f"[yellow]warning[/yellow]: failed to re-set module config: {key}: {exc}"
|
||||
)
|
||||
|
||||
def reload_module(
|
||||
self, module: Union[str, "pwncat.modules.BaseModule"]
|
||||
) -> "pwncat.modules.BaseModule":
|
||||
|
|
Loading…
Reference in New Issue