Skip to content

Commit

Permalink
check for multi region trails
Browse files Browse the repository at this point in the history
  • Loading branch information
sergargar committed Mar 26, 2024
1 parent 4c85178 commit ad80d3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,18 @@ def execute(self):
findings = []
potential_enumeration = {}
found_potential_enumeration = False
for trail in cloudtrail_client.trails:
multiregion_trail = None
# Check if any trail is multi-region so we only need to check once
for trail in cloudtrail_client.trails.values():
if trail.is_multiregion:
multiregion_trail = trail
break
trails_to_scan = (
cloudtrail_client.trails.values()
if not multiregion_trail
else [multiregion_trail]
)
for trail in trails_to_scan:
for event_name in ENUMERATION_ACTIONS:
for event_log in cloudtrail_client.__lookup_events__(
trail=trail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ def execute(self):
findings = []
potential_privilege_escalation = {}
found_potential_privilege_escalation = False
for trail in cloudtrail_client.trails:
multiregion_trail = None
# Check if any trail is multi-region so we only need to check once
for trail in cloudtrail_client.trails.values():
if trail.is_multiregion:
multiregion_trail = trail
trails_to_scan = (
cloudtrail_client.trails.values()
if not multiregion_trail
else [multiregion_trail]
)
for trail in trails_to_scan:
for event_name in PRIVILEGE_ESCALATION_ACTIONS:
for event_log in cloudtrail_client.__lookup_events__(
trail=trail,
Expand Down

0 comments on commit ad80d3b

Please sign in to comment.