-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from veracode/reportingapi-deletedscans
Fix for #91 - new reporting api scan type
- Loading branch information
Showing
7 changed files
with
89 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import time | ||
import sys | ||
import json | ||
import datetime | ||
from veracode_api_py import Analytics | ||
|
||
wait_seconds = 15 | ||
|
||
print('Generating deleted scans report...') | ||
theguid = Analytics().create_report(report_type="deletedscans",deletion_start_date='2024-07-01',deletion_end_date='2024-12-31') | ||
|
||
print('Checking status for report {}...'.format(theguid)) | ||
thestatus,thescans=Analytics().get_deleted_scans(theguid) | ||
|
||
while thestatus != 'COMPLETED': | ||
print('Waiting {} seconds before we try again...'.format(wait_seconds)) | ||
time.sleep(wait_seconds) | ||
print('Checking status for report {}...'.format(theguid)) | ||
thestatus,thescans=Analytics().get_deleted_scans(theguid) | ||
|
||
recordcount = len(thescans) | ||
|
||
print('Retrieved {} scans'.format(recordcount)) | ||
|
||
if recordcount > 0: | ||
now = datetime.datetime.now().astimezone() | ||
filename = 'report-{}'.format(now) | ||
with open('{}.json'.format(filename), 'w') as outfile: | ||
json.dump(thescans,outfile) | ||
outfile.close() | ||
|
||
print('Wrote {} findings to {}.json'.format(recordcount,filename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters