Possible refactor, adding Typer functionality, improving loops, added configuration checks #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I've written up a few possible considerations for refactoring some concepts in your scripts. I've based a number of these around a library called
Typer
, which I've found quite helpful in converting my one-off scripts into re-usable tools. I've also addeddateparser
in conjunction withTyper
for a nicer interface for entering dates as command line arguments.In addition to the few TODOs I've added into the code, I've also added a requirements.txt for easier installation. The hard-coded versions could be removed for looser installation requirements if desired.
The fully capitalized filenames are a bit non-standard.
The GET-CRIT-VULN.py could be broken into separate functions based on the API calls that are made to the crowdstrike APIs, and then if specific functionality needs to be re-used or could be its own command line call, this could be broken out in the future. But that is a refactor that should only be done when the business goals of the script call for it.
It would be nice if the falconpy library had better typehints. That's not a fault of this tool, but in order to satisfy the type checker for now, I've typed the resulting variables from the calls from the library as plain
dict
for now.Overall, this is a nice little tool and hopefully this PR provides some ideas and inspiration for future changes. Feel free to close this PR without merging if you'd like and then you can always check it out if you're interested in some of the ideas.