google / gcp_scanner

A comprehensive scanner for Google Cloud
Apache License 2.0
305 stars 95 forks source link

fix: Add timestamp to filename while saving output of gcp scan #134

Closed mshudrak closed 1 year ago

mshudrak commented 1 year ago

This PR fixes https://github.com/google/gcp_scanner/issues/79. This PR is continuation of #84.

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.