Skip to content

Commit

Permalink
add generate map
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jan 29, 2026
1 parent 73fcb41 commit 7fe6af8
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/env python

import requests
import json
import re

__version__ = "1.0.0"

def fetch_aws_service_data():
"""
Fetches the list of service prefixes and friendly names from
AWS Policy Sentry's maintained data (official-ish source of truth).
"""
print("[*] Fetching latest AWS service metadata...")
# This URL points to a well-maintained community list derived from IAM docs
url = "https://raw.githubusercontent.com/salesforce/policy_sentry/master/policy_sentry/shared/data/iam-definition.json"

try:
response = requests.get(url, timeout=10)
response.raise_for_status()
data = response.json()

service_map = {}
for service in data:
prefix = service.get('prefix')
name = service.get('service_name')
if prefix and name:
service_map[prefix] = name

return service_map
except Exception as e:
print(f"[!] Failed to fetch data: {e}")
return None

def main():
service_map = fetch_aws_service_data()
if service_map:
output_file = "aws_service_map.json"
with open(output_file, 'w') as f:
json.dump(service_map, f, indent=4)
print(f"[+] Successfully generated {output_file} with {len(service_map)} services.")
else:
print("[!] Could not generate map.")

if __name__ == "__main__":
main()

0 comments on commit 7fe6af8

Please sign in to comment.