forked from p15670423/monkey
* Exceptions handling for sending findings
This commit is contained in:
parent
f506eb3dd1
commit
90554f63cb
|
@ -77,11 +77,15 @@ class AWSExporter(Exporter):
|
||||||
securityhub = boto3.client('securityhub',
|
securityhub = boto3.client('securityhub',
|
||||||
aws_access_key_id=creds_dict.get('aws_access_key_id', ''),
|
aws_access_key_id=creds_dict.get('aws_access_key_id', ''),
|
||||||
aws_secret_access_key=creds_dict.get('aws_secret_access_key', ''))
|
aws_secret_access_key=creds_dict.get('aws_secret_access_key', ''))
|
||||||
import_response = securityhub.batch_import_findings(Findings=findings_list)
|
try:
|
||||||
print import_response
|
import_response = securityhub.batch_import_findings(Findings=findings_list)
|
||||||
if import_response['ResponseMetadata']['HTTPStatusCode'] == 200:
|
print import_response
|
||||||
return True
|
if import_response['ResponseMetadata']['HTTPStatusCode'] == 200:
|
||||||
else:
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('AWS security hub findings failed to send.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue