From aa15b67fca68c64d6db290c9c47aedc18e6b6b6b Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Tue, 23 Apr 2019 12:19:34 +0300 Subject: [PATCH] Added some debug logs --- monkey/monkey_island/cc/resources/aws_exporter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/resources/aws_exporter.py b/monkey/monkey_island/cc/resources/aws_exporter.py index b9b85d269..2ec2f25dd 100644 --- a/monkey/monkey_island/cc/resources/aws_exporter.py +++ b/monkey/monkey_island/cc/resources/aws_exporter.py @@ -105,10 +105,15 @@ class AWSExporter(Exporter): @staticmethod def _send_findings(findings_list, region): try: - securityhub = boto3.client('securityhub', region_name=region) + logger.debug("Trying to acquire securityhub boto3 client in " + region) + security_hub_client = boto3.client('securityhub', region_name=region) + logger.debug("Client acquired: {0}".format(repr(security_hub_client))) + # Assumes the machine has the correct IAM role to do this, @see # https://github.com/guardicore/monkey/wiki/Monkey-Island:-Running-the-monkey-on-AWS-EC2-instances - import_response = securityhub.batch_import_findings(Findings=findings_list) + import_response = security_hub_client.batch_import_findings(Findings=findings_list) + logger.debug("Import findings response: {0}".format(repr(import_response))) + if import_response['ResponseMetadata']['HTTPStatusCode'] == 200: return True else: