Skip to content

Commit fe02fc7

Browse files
authored
Merge pull request #43 from rstalets/main
Resolve issue #42 regarding smash.py handling of EBS and AMI
2 parents 95bf62e + b40b488 commit fe02fc7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

endgame/command/smash.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def smash(service, evil_principal, profile, region, dry_run, undo, cloak, exclud
141141
translated_service = utils.get_service_translation(provided_service=resource.service)
142142
# client = None
143143
client = get_boto3_client(profile=profile, service=translated_service, region=region, cloak=cloak)
144-
response_message = smash_resource(service=translated_service, region=region, name=name,
144+
response_message = smash_resource(service=resource.service, region=region, name=name,
145145
current_account_id=current_account_id,
146146
client=client, undo=undo, dry_run=dry_run, evil_principal=evil_principal)
147147
if undo and not dry_run:
@@ -166,7 +166,6 @@ def smash_resource(
166166
dry_run: bool,
167167
evil_principal: str,
168168
) -> ResponseMessage:
169-
service = utils.get_service_translation(provided_service=service)
170169
response_message = expose_service(provided_service=service, region=region, name=name,
171170
current_account_id=current_account_id,
172171
client=client, undo=undo, dry_run=dry_run, evil_principal=evil_principal)

endgame/exposure_via_sharing_apis/ec2_amis.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class Ec2Image(ResourceSharingApi, ABC):
1515
def __init__(self, name: str, region: str, client: boto3.Session.client, current_account_id: str):
16-
self.service = "ec2"
16+
self.service = "ec2-ami"
1717
self.resource_type = "image"
1818
self.region = region
1919
self.current_account_id = current_account_id
@@ -168,7 +168,7 @@ def parse_evil_principal(self, evil_principal: str) -> str:
168168
class Ec2Images(ResourceTypes):
169169
def __init__(self, client: boto3.Session.client, current_account_id: str, region: str):
170170
super().__init__(client, current_account_id, region)
171-
self.service = "ec2"
171+
self.service = "ec2-ami"
172172
self.resource_type = "image"
173173

174174
@property
@@ -181,7 +181,7 @@ def resources(self) -> [ListResourcesResponse]:
181181
image_id = resource.get("ImageId")
182182
name = resource.get("Name")
183183
volume_id = resource.get("VolumeId")
184-
arn = f"arn:aws:{self.service}:{self.region}:{self.current_account_id}:{self.resource_type}/{image_id}"
184+
arn = f"arn:aws:ec2:{self.region}:{self.current_account_id}:{self.resource_type}/{image_id}"
185185
list_resources_response = ListResourcesResponse(
186186
service=self.service, account_id=self.current_account_id, arn=arn, region=self.region,
187187
resource_type=self.resource_type, name=image_id)

0 commit comments

Comments
 (0)