diff --git a/monkey/monkey_island/cc/resources/remote_run.py b/monkey/monkey_island/cc/resources/remote_run.py index 8f02ee066..df4b808e2 100644 --- a/monkey/monkey_island/cc/resources/remote_run.py +++ b/monkey/monkey_island/cc/resources/remote_run.py @@ -67,7 +67,11 @@ class RemoteRun(flask_restful.Resource): for result in results: results_copy.append( AWSCommandResults( - result.response_code, result.stdout, result.stderr, result.status.name.lower() + result.instance_id, + result.response_code, + result.stdout, + result.stderr, + result.status.name.lower(), ) ) return results_copy diff --git a/monkey/monkey_island/cc/services/aws/aws_command_runner.py b/monkey/monkey_island/cc/services/aws/aws_command_runner.py index 6e88c0e21..9a85ba49a 100644 --- a/monkey/monkey_island/cc/services/aws/aws_command_runner.py +++ b/monkey/monkey_island/cc/services/aws/aws_command_runner.py @@ -23,6 +23,7 @@ class AWSCommandStatus(Enum): @dataclass(frozen=True) class AWSCommandResults: + instance_id: str response_code: int stdout: str stderr: str @@ -137,6 +138,7 @@ def _fetch_command_results( aws_command_result_status = AWSCommandStatus.ERROR return AWSCommandResults( + target_instance_id, command_results["ResponseCode"], command_results["StandardOutputContent"], command_results["StandardErrorContent"], diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/aws/test_aws_command_runner.py b/monkey/tests/unit_tests/monkey_island/cc/services/aws/test_aws_command_runner.py index 3386772ed..f04932b93 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/aws/test_aws_command_runner.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/aws/test_aws_command_runner.py @@ -228,5 +228,5 @@ def test_failed_command(send_command_response, error_response): ], ) def test_command_resuls_status(status, success): - results = AWSCommandResults(0, "", "", status) + results = AWSCommandResults(INSTANCE_ID, 0, "", "", status) assert results.success == success