spark1security / n0s1

Secret Scanner for Slack, Jira, Confluence, Asana, Wrike and Linear
https://spark1.us/n0s1
GNU General Public License v3.0
38 stars 11 forks source link

Save findings before exiting due to keyboard interrupt #19

Closed jarp0l closed 2 months ago

jarp0l commented 2 months ago

Is your feature request related to a problem? Please describe. It's always frustrating when you need to interrupt the tool (e.g., due to large number of issues in Jira or having to scan many projects) and lose all the findings because the tool does not save anything before exiting.

Describe the solution you'd like I would like the tool to catch keyboard interrupts (Ctrl+C), save the findings so far, provide user feedback about saving, and then exit gracefully with status code 130 (ref, ref).

Describe alternatives you've considered An alternative is to periodically save findings during the tool's execution, but this might add unnecessary overhead and complexity.

jarp0l commented 2 months ago

This is my implementation which I did for my use. It works as expected. Please review and maybe consider merging it if you think it's good: https://github.com/jarp0l/n0s1/blob/d76cb81a64a5dd52a4053e60eda6476f3be537fd/src/n0s1/n0s1.py#L631-L637

I might need to move log_message("Done!") line to finally block.

blupants commented 2 months ago

This is my implementation which I did for my use. It works as expected. Please review and maybe consider merging it if you think it's good: https://github.com/jarp0l/n0s1/blob/d76cb81a64a5dd52a4053e60eda6476f3be537fd/src/n0s1/n0s1.py#L631-L637

I might need to move log_message("Done!") line to finally block.

Thank you for your suggestion. It will be included in the next release.

jarp0l commented 2 months ago

Closing this because of #21.