Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reloading of custom modules using "reload" #241

Open
DanaEpp opened this issue Jan 31, 2022 · 3 comments · May be fixed by #243
Open

Support reloading of custom modules using "reload" #241

DanaEpp opened this issue Jan 31, 2022 · 3 comments · May be fixed by #243
Labels
enhancement New feature or request

Comments

@DanaEpp
Copy link

DanaEpp commented Jan 31, 2022

When doing custom module development it is rather tedious to have to restart pwncat and establish a new session just to reload the changes to the module code. It would be nice to do reload /path/to/modules, or to otherwise auto-reload when a module file has been altered.

Alternatively, having an option during dev to pass a switch to pwncat-cs to have it reload modules from disk on every "run", or offer a new command like run-dev that would always fetch the module code would be useful.

@DanaEpp DanaEpp added the enhancement New feature or request label Jan 31, 2022
@DanaEpp DanaEpp changed the title Support reloading of modules using "reload" Support reloading of custom modules using "reload" Jan 31, 2022
@calebstewart
Copy link
Owner

calebstewart commented Feb 2, 2022

This shouldn't be too difficult to implement. I should be able to simply remove the reference from Manager.modules and sys.modules, then reload the Python module. I'll try to get this added soon!

@calebstewart calebstewart linked a pull request Feb 3, 2022 that will close this issue
5 tasks
@calebstewart
Copy link
Owner

I implemented a first-pass on this in the referenced PR. @DanaEpp if you have the time/interest, I'd appreciate you giving that branch a try. You should be able to either use load --reload /path/to/modules or run --reload my.module.name. The former will obviously explicitly reload the module, while the latter will reload the module prior to execution (as mentioned in your original issue above).

Thanks for the suggestion. This is a really good feature to have for debugging, and I don't know why it didn't occur to me before! 👍

@DanaEpp
Copy link
Author

DanaEpp commented Feb 3, 2022

I implemented a first-pass on this in the referenced PR. @DanaEpp if you have the time/interest, I'd appreciate you giving that branch a try. You should be able to either use load --reload /path/to/modules or run --reload my.module.name. The former will obviously explicitly reload the module, while the latter will reload the module prior to execution (as mentioned in your original issue above).

Thanks for the suggestion. This is a really good feature to have for debugging, and I don't know why it didn't occur to me before! 👍

Thanks for such a quick turnaround Caleb! This will be an awesome feature. I am right in the middle of writing a module as we speak, so this is timely.

I'll try to test this branch tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants