Closed 3V3RYONE closed 1 year ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
I like this change but one small thing that I notice immediately. Please don't use ":" in output filenames as this will not work well on Windows and MacOS.
@ZetaTwo Thank you for your comment. Fair point really. I just used colon to distinguish between the date and time in the filename. In that case we might try out other combinations. I am listing a few below:
Feel free to let me know the best convention that we should follow! Thank you :)
I think filename-YYYY-MM-DD_HH-MM-SS.json
is the best.
@ZetaTwo Worked on your suggestion with the latest commit. The new format is filename-YYYY-MM-DD_HH-MM-SS.json
!
LGTM
@ZetaTwo any updates on this?
Fixed all comments in #134, thanks for the PR. closing this PR now.
This PR fixes #79 .
Reason of Bug
The current
src/gcp_scanner/scanner.py
file in the codebase, creates a JSON file with the name of the project to store the output of the scan. If the file already exists, it opens the same file in the append mode and appends the output of the scan to the same file.Approach to fix the bug
I added the timestamp of the scan to the name of the output file while writing the scan results. In this way, for every scan, there will be different output files where the output would be written into.
Before the changes
The output gets appended to same file in case of multiple scans.
In the picture shown below, I use gcp_scan three times and I have shown the size of the output file after each scan. The
wc
command outputs the number of lines in the file to terminal. It can be clearly seen after each scan the number of lines in the output file gets increased by 2484. This indicates the output is appended to the same file.After the changes
The output gets written to different files with unique timestamps of the scan.
In the picture shown below, I used gcp_scan three times and I have shown the list of files present in the output directory after each scan. It can be clearly seen that after each scan, the number of files increases based on the timestamp of the scan. Thus, the output is written to new files.
Note
Feel free to let me know if any changes are required in the current PR. Thanks a ton! :)
Checklist