1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-24 01:25:37 +01:00

Maintain module config after reload from load_modules

This commit is contained in:
Caleb Stewart 2022-02-02 22:50:28 -05:00
parent ef7b5cfc74
commit f152c9df50

View File

@ -971,8 +971,21 @@ class Manager:
# Update the current module context if we just replaced a module # Update the current module context if we just replaced a module
if old_module != new_module and self.config.module == old_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) 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( def reload_module(
self, module: Union[str, "pwncat.modules.BaseModule"] self, module: Union[str, "pwncat.modules.BaseModule"]
) -> "pwncat.modules.BaseModule": ) -> "pwncat.modules.BaseModule":