Improved Ctrl + c behavior#1231
Conversation
|
Much needed as default is really slow! Should be merged. |
Yep definitely! Thanks for the PR! I'll look into this soon. |
|
Hi, so I looked a bit deeper into it. Basically this solution still does not really exit the child threads gracefully, but just immediately aborts everything with the call to Let's go forward with this for now, so we at least have a way forcefully shutdown everything without that we need to press Please also fix the Pull request description (remove the prefilled text like |
Description
Please include a summary of the change and which issue is fixed, or what the enhancement does.
List any dependencies that are required for this change.
If you have used AI in any form, please state the tool you used (e.g. Claude Code, Cursor, Amp) along with the extent that the work was AI-assisted. See the project's AI policy for more details: https://github.com/Pennyw0rth/NetExec/blob/main/AI_POLICY.md
In this version, we use os._exit(0) to stop execution. It is a "Hard Kill" that ends the process without waiting for the threads to finish
When using asyncio.run_in_executor, the main thread is not "working" on the scan, but rather is monitoring the event loop. This allows the CTRL+C signal to be processed instantly rather than waiting for a network socket to respond.
Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
Setup guide for the review
Please provide guidance on what setup is needed to test the introduced changes, such as your locally running machine Python version & OS, as well as the target(s) you tested against, including software versions.
In particular:
Bug Fix: Please provide a short description on how to trigger the bug, to make the bug reproducable for the reviewer.
Added Feature/Enhancement: Please specify what setup is needed in order to test the changes, such as:
You can test it by scaning any /24 or segment on any protocol. Tested on Linux and Windows
Related: (Win Binary) Ctr + Z/C/X doesn't work #61
Screenshots (if appropriate):
Screenshots are always nice to have and can give a visual representation of the change.
If appropriate, include before and after screenshot(s) to show which results are to be expected.
https://github.com/user-attachments/assets/1929d2ba-abd5-4b8c-810f-01fb23355a00
https://github.com/user-attachments/assets/bbf1fe46-6094-4461-84f7-3f0b7b5c796d
Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)Note: There are other 2 issues when running ruff not related to my changes