Closed Am0stafa closed 1 year ago
we have #84 already addressing this problem.
we have #84 already addressing this problem.
Thank you for pointing this out. I understand that there is already an ongoing PR (#84) that addresses the same issue. My approach offers an alternative solution to the problem, and I'm aware that the existing PR might be outdated and result in conflicts.
Considering the lack of response from the author of the old PR, I would like to propose my solution for your review. If you find it beneficial or more suitable for the project, I am willing to work on integrating the changes. If you think this PR should be closed, that is fine as well.
Please let me know your thoughts and how you would like to proceed with this matter.
There is #84 that's almost ready for merge. I'd close this PR.
Description:
This PR addresses issue #79, where the output of multiple scans on a single project was appended to the same JSON file. The changes introduced in this PR ensure that a unique file is created for each scan, preventing the output of different scans from being appended to the same file.
Key Changes:
[x] Added a new
generate_unique_filename
function that generates a unique file name within the output directory by appending a counter to the base name if a file with the same name already exists. This function is essential in preventing the overwriting or appending of previous scan results, as it ensures that each new scan will be saved in a separate file with a unique name.[x] Updated the
crawl_loop
function insrc/gcp_scanner/scanner.py
to use thegenerate_unique_filename
function when saving the output of the scan. This ensures that a new, unique file is created for each scan, rather than appending the output to an existing file.By implementing these changes, the output of each scan is now saved in a separate file, eliminating the issue of appending scan results to the same file. This makes it easier for users to analyze the output of individual scans and prevents the unintentional merging of scan results. The
generate_unique_filename
function plays a crucial role in ensuring that each scan's output is saved in a distinct file, which ultimately enhances the usability and reliability of the GCP resource scanner.Related Issues
fixes #79