├── tests ├── __init__.py ├── samples │ ├── variables │ │ ├── ec2-instances-ids.json │ │ ├── iam-usernames.json │ │ ├── s3-buckets-names.json │ │ ├── lambda-functions-names.json │ │ ├── ecs-clusters-arns.json │ │ ├── iam-policies-arns_list-attached-role-policies.json │ │ ├── secretsmanager-secrets-arns.json │ │ ├── iam-role-policies.json │ │ ├── iam-policies-arns.json │ │ ├── iam-policy-versions_get-policy.json │ │ ├── iam-policy-versions.json │ │ ├── iam-rolenames.json │ │ ├── iam-policies-versions_list-policies.json │ │ ├── ecs-cluster-services.json │ │ └── ecs-cluster-tasks.json │ └── responses │ │ ├── ecs-list-clusters.json │ │ ├── iam-list-role-policies.json │ │ ├── amplifybackend-list-s3-buckets.json │ │ ├── iam-list-attached-role-policies.json │ │ ├── s3-list-buckets.json │ │ ├── ecs-list-services.json │ │ ├── iam-list-users.json │ │ ├── ecs-list-tasks.json │ │ ├── iam-get-policy.json │ │ ├── iam-list-policy-versions.json │ │ ├── secretsmanager-list-secrets.json │ │ ├── iam-list-policies.json │ │ ├── lambda-list-functions.json │ │ ├── ec2_describe_vpcs.json │ │ ├── ec2_describe_client_vpn_endpoints.json │ │ ├── ec2-describe-instances.json │ │ └── iam-list-roles.json └── test_out_variables.py ├── requirements-dev.txt ├── MANIFEST.in ├── setup.cfg ├── awsenum ├── __init__.py ├── __main__.py ├── apidef │ ├── __init__.py │ ├── aws-apischema.yml │ ├── normalize.py │ ├── filters.py │ ├── load.py │ └── api-meta.yml ├── utils.py ├── awsaccount.py ├── client.py ├── args.py ├── main.py ├── operation.py └── brute.py ├── requirements.txt ├── .gitignore ├── awsenum.py ├── setup.py ├── README.md └── LICENSE /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include requirements.txt -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | test=pytest 3 | -------------------------------------------------------------------------------- /awsenum/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from .main import main 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | argcomplete 2 | boto3 3 | botocore 4 | jmespath 5 | requests 6 | pyyaml 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | build/ 3 | dist/ 4 | 5 | __pycache__ 6 | awsenum-*.json 7 | awsenum.egg-info 8 | .eggs -------------------------------------------------------------------------------- /awsenum/__main__.py: -------------------------------------------------------------------------------- 1 | 2 | from .main import main 3 | 4 | if __name__ == '__main__': 5 | main() 6 | -------------------------------------------------------------------------------- /awsenum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import awsenum 4 | 5 | if __name__ == '__main__': 6 | exit(awsenum.main()) 7 | -------------------------------------------------------------------------------- /awsenum/apidef/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from .load import load_api, list_all_base_services, \ 4 | list_base_service_operations 5 | -------------------------------------------------------------------------------- /tests/samples/variables/ec2-instances-ids.json: -------------------------------------------------------------------------------- 1 | { 2 | "ec2-instances-ids": [ 3 | "i-1234567890abcdef0" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-usernames.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-usernames": [ 3 | "Administrator", 4 | "iamtest" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tests/samples/variables/s3-buckets-names.json: -------------------------------------------------------------------------------- 1 | { 2 | "s3-buckets-names": [ 3 | "test2joadijfoisadjiofjd", 4 | "testaskldfjaiopsdcnoidc" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tests/samples/variables/lambda-functions-names.json: -------------------------------------------------------------------------------- 1 | { 2 | "lambda-functions-names": [ 3 | "vulnerable_lambda_cgidmqmvxyxvk9-policy_applier_lambda1" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tests/samples/variables/ecs-clusters-arns.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecs-clusters-arns": [ 3 | "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-policies-arns_list-attached-role-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-policies-arns": [ 3 | "arn:aws:iam::aws:policy/aws-service-role/AWSElasticLoadBalancingServiceRolePolicy" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tests/samples/variables/secretsmanager-secrets-arns.json: -------------------------------------------------------------------------------- 1 | { 2 | "secretsmanager-secrets-arns": [ 3 | "arn:aws:secretsmanager:us-east-1:123456789012:secret:vulnerable_lambda_cgidu3dbm92fy9-final_flag-D6GJOb" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-role-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-role-policies": { 3 | "role": "cg-lambda-invoker-vulnerable_lambda_cgidqhlz86ajy2", 4 | "policies": [ 5 | "lambda-invoker" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-policies-arns.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-policies-arns": [ 3 | "arn:aws:iam::123456789012:policy/my-test-iam-policy", 4 | "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /tests/samples/responses/ecs-list-clusters.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "args": {}, 4 | "response": { 5 | "clusterArns": [ 6 | "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-policy-versions_get-policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-policy-versions": { 3 | "policy": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 4 | "versions": [ 5 | "v1" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-role-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "PolicyNames": [ 4 | "lambda-invoker" 5 | ] 6 | }, 7 | 8 | "args": { 9 | "RoleName": "cg-lambda-invoker-vulnerable_lambda_cgidqhlz86ajy2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-policy-versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-policy-versions": { 3 | "policy": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 4 | "versions": [ 5 | "v5", 6 | "v4", 7 | "v3", 8 | "v2", 9 | "v1" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-rolenames.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-rolenames": [ 3 | "AWSServiceRoleForECS", 4 | "AWSServiceRoleForElasticLoadBalancing", 5 | "AWSServiceRoleForRDS", 6 | "AWSServiceRoleForSupport", 7 | "AWSServiceRoleForTrustedAdvisor", 8 | "cg-lambda-invoker-vulnerable_lambda_cgidqhlz86ajy2", 9 | "vulnerable_lambda_cgidqhlz86ajy2-policy_applier_lambda1" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /tests/samples/responses/amplifybackend-list-s3-buckets.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "Buckets": [ 4 | { 5 | "CreationDate": "2022-05-24T06:24:25.000Z", 6 | "Name": "test2joadijfoisadjiofjd" 7 | }, 8 | { 9 | "CreationDate": "2022-05-24T06:23:54.000Z", 10 | "Name": "testaskldfjaiopsdcnoidc" 11 | } 12 | ] 13 | }, 14 | "args": {} 15 | } 16 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-attached-role-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": { 3 | "RoleName": "AWSServiceRoleForElasticLoadBalancing" 4 | }, 5 | "response": { 6 | "AttachedPolicies": [ 7 | { 8 | "PolicyName": "AWSElasticLoadBalancingServiceRolePolicy", 9 | "PolicyArn": "arn:aws:iam::aws:policy/aws-service-role/AWSElasticLoadBalancingServiceRolePolicy" 10 | } 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/samples/variables/iam-policies-versions_list-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "iam-policies-versions": [ 3 | { 4 | "versions": [ 5 | "v2" 6 | ], 7 | "policy": "arn:aws:iam::123456789012:policy/my-test-iam-policy" 8 | }, 9 | { 10 | "versions": [ 11 | "v1" 12 | ], 13 | "policy": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /tests/samples/responses/s3-list-buckets.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "Buckets": [ 4 | { 5 | "Name": "test2joadijfoisadjiofjd", 6 | "CreationDate": "2022-05-24T06:24:25.000Z" 7 | }, 8 | { 9 | "Name": "testaskldfjaiopsdcnoidc", 10 | "CreationDate": "2022-05-24T06:23:54.000Z" 11 | } 12 | ], 13 | "Owner": { 14 | "DisplayName": "myself", 15 | "ID": "d3e4102ab110f7b65e08e6fbf9b0745b69e5055bc4dfcb1e61498234d9f1dafd" 16 | } 17 | }, 18 | "args": {} 19 | } 20 | -------------------------------------------------------------------------------- /tests/samples/variables/ecs-cluster-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecs-cluster-services": { 3 | "cluster": "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster", 4 | "services": [ 5 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/privd", 6 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/vault", 7 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/vulnsite" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/samples/responses/ecs-list-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": { 3 | "cluster": "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster" 4 | }, 5 | "response": { 6 | "serviceArns": [ 7 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/privd", 8 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/vault", 9 | "arn:aws:ecs:us-east-1:123456789012:service/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/vulnsite" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-users.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "Users": [ 4 | { 5 | "UserName": "Administrator", 6 | "UserId": "AIDAXY5COEUBX46MKPGGP", 7 | "Path": "/", 8 | "CreateDate": "2022-03-20 10:14:44+00:00", 9 | "Arn": "arn:aws:iam::012345789012:user/Administrator" 10 | }, 11 | { 12 | "UserName": "iamtest", 13 | "UserId": "AIDAXY5COEUB3MJ3FVTO2", 14 | "Path": "/", 15 | "CreateDate": "2022-05-07 12:24:13+00:00", 16 | "Arn": "arn:aws:iam::012345789012:user/iamtest" 17 | } 18 | ], 19 | "IsTruncated": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/samples/variables/ecs-cluster-tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecs-cluster-tasks": { 3 | "cluster": "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster", 4 | "tasks": [ 5 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/23935a115a614966bcb29ad05a4e5f37", 6 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/478feecd20da4193a44d2c36a43e5abd", 7 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/9548c2147007486dafb15cdcd04f7a65", 8 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/be02604fad1d4bdd9ded74ff49688fbc" 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/samples/responses/ecs-list-tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": { 3 | "cluster": "arn:aws:ecs:us-east-1:123456789012:cluster/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster" 4 | }, 5 | "response": { 6 | "taskArns": [ 7 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/23935a115a614966bcb29ad05a4e5f37", 8 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/478feecd20da4193a44d2c36a43e5abd", 9 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/9548c2147007486dafb15cdcd04f7a65", 10 | "arn:aws:ecs:us-east-1:123456789012:task/ecs-takeover-ecs_takeover_cgidmdfsp0i5dv-cluster/be02604fad1d4bdd9ded74ff49688fbc" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /awsenum/utils.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | import json 3 | import datetime 4 | import base64 5 | 6 | def load_yaml(filepath): 7 | with open(filepath) as fi: 8 | return yaml.safe_load(fi) 9 | 10 | 11 | def save_json(obj, filepath): 12 | obj = make_json_serializable(obj) 13 | with open(filepath, "w") as fo: 14 | json.dump(obj, fo, sort_keys=True, indent=4) 15 | 16 | 17 | def make_json_serializable(obj): 18 | if type(obj) is dict: 19 | for k in obj: 20 | obj[k] = make_json_serializable(obj[k]) 21 | elif type(obj) is list or type(obj) is tuple: 22 | obj = [make_json_serializable(x) for x in obj] 23 | elif type(obj) is datetime.datetime: 24 | obj = str(obj) 25 | elif isinstance(obj, bytes): 26 | return base64.b64encode(obj).decode() 27 | 28 | return obj 29 | 30 | def now_datetime(): 31 | return datetime.datetime.now() 32 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-get-policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": { 3 | "PolicyArn": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y" 4 | }, 5 | "response": { 6 | "Policy": { 7 | "Arn": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 8 | "AttachmentCount": 1, 9 | "CreateDate": "2022-06-16 05:57:05+00:00", 10 | "DefaultVersionId": "v1", 11 | "Description": "cg-raynor-policy", 12 | "IsAttachable": true, 13 | "Path": "/", 14 | "PermissionsBoundaryUsageCount": 0, 15 | "PolicyId": "ANPAXY5COEUBSIRZANN57", 16 | "PolicyName": "cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 17 | "Tags": [], 18 | "UpdateDate": "2022-06-16 05:57:07+00:00" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open("README.md", "r") as fh: 4 | long_description = fh.read() 5 | 6 | with open('requirements.txt') as f: 7 | requirements = f.read().splitlines() 8 | 9 | name = "awsenum" 10 | 11 | setuptools.setup( 12 | name=name, 13 | version="0.0.1", 14 | author="Eloy Perez Gonzalez", 15 | author_email="zer1t0ps@protonmail.com", 16 | description="Enumerate AWS permissions and resources", 17 | url="https://github.com/zer1t0/awsenum", 18 | project_urls={ 19 | "Repository": "https://github.com/zer1t0/awsenum" 20 | }, 21 | long_description=long_description, 22 | long_description_content_type="text/markdown", 23 | packages=setuptools.find_packages(), 24 | install_requires=requirements, 25 | classifiers=[ 26 | "Programming Language :: Python :: 3", 27 | "License :: OSI Approved :: GNU Affero General Public License v3", 28 | "Operating System :: OS Independent", 29 | ], 30 | entry_points={ 31 | "console_scripts": [ 32 | "awsenum = awsenum.main:main", 33 | ] 34 | }, 35 | setup_requires=['pytest-runner'], 36 | tests_require=['pytest'], 37 | ) 38 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-policy-versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "Versions": [ 4 | { 5 | "VersionId": "v5", 6 | "IsDefaultVersion": false, 7 | "CreateDate": "2022-06-16 05:57:07+00:00" 8 | }, 9 | { 10 | "VersionId": "v4", 11 | "IsDefaultVersion": false, 12 | "CreateDate": "2022-06-16 05:57:07+00:00" 13 | }, 14 | { 15 | "VersionId": "v3", 16 | "IsDefaultVersion": false, 17 | "CreateDate": "2022-06-16 05:57:07+00:00" 18 | }, 19 | { 20 | "VersionId": "v2", 21 | "IsDefaultVersion": false, 22 | "CreateDate": "2022-06-16 05:57:07+00:00" 23 | }, 24 | { 25 | "VersionId": "v1", 26 | "IsDefaultVersion": true, 27 | "CreateDate": "2022-06-16 05:57:05+00:00" 28 | } 29 | ] 30 | }, 31 | "args": { 32 | "PolicyArn": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/samples/responses/secretsmanager-list-secrets.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": {}, 3 | "response": { 4 | "SecretList": [ 5 | { 6 | "ARN": "arn:aws:secretsmanager:us-east-1:123456789012:secret:vulnerable_lambda_cgidu3dbm92fy9-final_flag-D6GJOb", 7 | "CreatedDate": "2022-06-16 07:37:05.953000+02:00", 8 | "LastAccessedDate": "2022-06-16 02:00:00+02:00", 9 | "LastChangedDate": "2022-06-16 07:37:06.487000+02:00", 10 | "Name": "vulnerable_lambda_cgidu3dbm92fy9-final_flag", 11 | "SecretVersionsToStages": { 12 | "87BE3E5B-10CE-4A31-8507-DB298134B0E5": [ 13 | "AWSCURRENT" 14 | ] 15 | }, 16 | "Tags": [ 17 | { 18 | "Key": "Stack", 19 | "Value": "CloudGoat" 20 | }, 21 | { 22 | "Key": "Name", 23 | "Value": "cg-vulnerable_lambda_cgidu3dbm92fy9" 24 | }, 25 | { 26 | "Key": "Scenario", 27 | "Value": "vulnerable-lambda" 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-policies.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": { 3 | "Scope": "Local" 4 | }, 5 | "response": { 6 | "Policies": [ 7 | { 8 | "Arn": "arn:aws:iam::123456789012:policy/my-test-iam-policy", 9 | "AttachmentCount": 1, 10 | "CreateDate": "2022-05-07 12:23:02+00:00", 11 | "DefaultVersionId": "v2", 12 | "IsAttachable": true, 13 | "Path": "/", 14 | "PermissionsBoundaryUsageCount": 0, 15 | "PolicyId": "ANPAXY5COEUB6TNHSUQJ7", 16 | "PolicyName": "my-test-iam-policy", 17 | "UpdateDate": "2022-05-07 12:29:43+00:00" 18 | }, 19 | { 20 | "Arn": "arn:aws:iam::123456789012:policy/cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 21 | "AttachmentCount": 1, 22 | "CreateDate": "2022-06-16 05:57:05+00:00", 23 | "DefaultVersionId": "v1", 24 | "IsAttachable": true, 25 | "Path": "/", 26 | "PermissionsBoundaryUsageCount": 0, 27 | "PolicyId": "ANPAXY5COEUBSIRZANN57", 28 | "PolicyName": "cg-raynor-policy-iam_privesc_by_rollback_cgidu63ju2eo1y", 29 | "UpdateDate": "2022-06-16 05:57:07+00:00" 30 | } 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/samples/responses/lambda-list-functions.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": {}, 3 | "response": { 4 | "Functions": [ 5 | { 6 | "Architectures": [ 7 | "x86_64" 8 | ], 9 | "CodeSha256": "U982lU6ztPq9QlRmDCwlMKzm4WuOfbpbCou1neEBHkQ=", 10 | "CodeSize": 991559, 11 | "Description": "This function will apply a managed policy to the user of your choice, so long as the database says that it's okay...", 12 | "EphemeralStorage": { 13 | "Size": 512 14 | }, 15 | "FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:vulnerable_lambda_cgidmqmvxyxvk9-policy_applier_lambda1", 16 | "FunctionName": "vulnerable_lambda_cgidmqmvxyxvk9-policy_applier_lambda1", 17 | "Handler": "main.handler", 18 | "LastModified": "2022-06-14T06:16:10.687+0000", 19 | "MemorySize": 128, 20 | "PackageType": "Zip", 21 | "RevisionId": "5b37aa26-356b-4052-b3cd-b209787ab5f4", 22 | "Role": "arn:aws:iam::123456789012:role/vulnerable_lambda_cgidmqmvxyxvk9-policy_applier_lambda1", 23 | "Runtime": "python3.9", 24 | "Timeout": 3, 25 | "TracingConfig": { 26 | "Mode": "PassThrough" 27 | }, 28 | "Version": "$LATEST" 29 | } 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/samples/responses/ec2_describe_vpcs.json: -------------------------------------------------------------------------------- 1 | { 2 | "Vpcs": [ 3 | { 4 | "CidrBlock": "30.1.0.0/16", 5 | "DhcpOptionsId": "dopt-19edf471", 6 | "State": "available", 7 | "VpcId": "vpc-0e9801d129EXAMPLE", 8 | "OwnerId": "111122223333", 9 | "InstanceTenancy": "default", 10 | "CidrBlockAssociationSet": [ 11 | { 12 | "AssociationId": "vpc-cidr-assoc-062c64cfafEXAMPLE", 13 | "CidrBlock": "30.1.0.0/16", 14 | "CidrBlockState": { 15 | "State": "associated" 16 | } 17 | } 18 | ], 19 | "IsDefault": false, 20 | "Tags": [ 21 | { 22 | "Key": "Name", 23 | "Value": "Not Shared" 24 | } 25 | ] 26 | }, 27 | { 28 | "CidrBlock": "10.0.0.0/16", 29 | "DhcpOptionsId": "dopt-19edf471", 30 | "State": "available", 31 | "VpcId": "vpc-06e4ab6c6cEXAMPLE", 32 | "OwnerId": "222222222222", 33 | "InstanceTenancy": "default", 34 | "CidrBlockAssociationSet": [ 35 | { 36 | "AssociationId": "vpc-cidr-assoc-00b17b4eddEXAMPLE", 37 | "CidrBlock": "10.0.0.0/16", 38 | "CidrBlockState": { 39 | "State": "associated" 40 | } 41 | } 42 | ], 43 | "IsDefault": false, 44 | "Tags": [ 45 | { 46 | "Key": "Name", 47 | "Value": "Shared VPC" 48 | } 49 | ] 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /awsenum/awsaccount.py: -------------------------------------------------------------------------------- 1 | import botocore.client 2 | import botocore.session 3 | 4 | from collections import namedtuple 5 | 6 | def resolve_aws_account( 7 | profile, 8 | access_key=None, 9 | secret_key=None, 10 | session_token=None, 11 | region=None 12 | ): 13 | if access_key or secret_key or session_token: 14 | account = AWSAccount(access_key, secret_key, session_token, region) 15 | else: 16 | account = get_account_from_profile(profile) 17 | if region: 18 | account.region = region 19 | 20 | if not account.access_key: 21 | raise AccountError("No access key, please specify one") 22 | 23 | if not account.secret_key: 24 | raise AccountError("No secret key, please specify one") 25 | 26 | if not account.region: 27 | raise AccountError("No region can be found, please specify one") 28 | 29 | return account 30 | 31 | def list_profiles(): 32 | return botocore.session.Session().available_profiles 33 | 34 | def get_account_from_profile(profile): 35 | try: 36 | session = botocore.session.Session(profile=profile) 37 | creds = session.get_credentials() 38 | 39 | access_key = creds.access_key 40 | secret_key = creds.secret_key 41 | session_token = creds.token 42 | region = session._resolve_region_name(None, None) 43 | return AWSAccount(access_key, secret_key, session_token, region) 44 | except botocore.exceptions.ProfileNotFound: 45 | raise AccountError("Profile '{}' cannot be found".format(profile)) 46 | 47 | class AccountError(Exception): 48 | pass 49 | 50 | class AWSAccount: 51 | 52 | def __init__(self, access_key, secret_key, session_token, region): 53 | self.access_key = access_key 54 | self.secret_key = secret_key 55 | self.session_token = session_token 56 | self.region = region 57 | 58 | -------------------------------------------------------------------------------- /awsenum/apidef/aws-apischema.yml: -------------------------------------------------------------------------------- 1 | type: object 2 | patternProperties: 3 | # Services 4 | .+: 5 | type: object 6 | patternProperties: 7 | # Operations 8 | .+: 9 | type: object 10 | properties: 11 | allowed_client_error: {type: string} 12 | versions: 13 | type: array 14 | items: 15 | type: object 16 | properties: 17 | 18 | invar: 19 | oneOf: 20 | - type: object 21 | properties: 22 | name: {type: string} 23 | mode: {enum: [foreach, single]} 24 | required: [name] 25 | additionalProperties: false 26 | - type: string 27 | 28 | args: 29 | type: object 30 | patternProperties: 31 | .+: 32 | oneOf: 33 | - type: object 34 | properties: 35 | invar_path: {type: string} 36 | mode: {enum: [foreach, single]} 37 | required: [invar_path] 38 | additionalProperties: false 39 | 40 | - type: object 41 | properties: 42 | value: {} 43 | mode: {enum: [foreach, single]} 44 | required: [value] 45 | additionalProperties: false 46 | 47 | outvars: 48 | type: object 49 | patternProperties: 50 | .+: {type: string} 51 | 52 | additionalProperties: false 53 | 54 | outvars: 55 | type: object 56 | patternProperties: 57 | .+: {type: string} 58 | 59 | additionalProperties: false 60 | 61 | -------------------------------------------------------------------------------- /awsenum/client.py: -------------------------------------------------------------------------------- 1 | 2 | import boto3 3 | from threading import Lock 4 | from botocore.endpoint import MAX_POOL_CONNECTIONS 5 | import botocore.client 6 | 7 | 8 | def get_caller_identity(client_provider): 9 | resp = client_provider.get_client("sts").get_caller_identity() 10 | return resp["UserId"], resp["Account"], resp["Arn"] 11 | 12 | 13 | class ClientProvider: 14 | 15 | def __init__( 16 | self, 17 | account, 18 | verify=True, 19 | connect_timeout=5, 20 | read_timeout=60, 21 | max_retries=2, 22 | ): 23 | self.account = account 24 | self.verify = verify 25 | 26 | # there is a problem with the read_timeout for big requests 27 | # the read timeout is reached, and the client retries after sleeping 28 | # for a while, bad thing is that sleeping increases exponentially, so 29 | # first is 2s, then 4s, then 8s, then 16s, 30 | self.client_config = botocore.client.Config( 31 | connect_timeout=connect_timeout, 32 | read_timeout=read_timeout, 33 | retries={'max_attempts': max_retries}, 34 | max_pool_connections=MAX_POOL_CONNECTIONS * 2 35 | ) 36 | self.client_lock = Lock() 37 | self.clients = {} 38 | 39 | 40 | def get_client(self, service): 41 | with self.client_lock: 42 | return self._get_client(service) 43 | 44 | def _get_client(self, service): 45 | try: 46 | return self.clients[service] 47 | except KeyError: 48 | self.clients[service] = boto3.client( 49 | service, 50 | aws_access_key_id=self.account.access_key, 51 | aws_secret_access_key=self.account.secret_key, 52 | aws_session_token=self.account.session_token, 53 | region_name=self.account.region, 54 | verify=self.verify, 55 | config=self.client_config, 56 | ) 57 | 58 | return self.clients[service] 59 | 60 | -------------------------------------------------------------------------------- /tests/samples/responses/ec2_describe_client_vpn_endpoints.json: -------------------------------------------------------------------------------- 1 | { 2 | "ClientVpnEndpoints": [ 3 | { 4 | "ClientVpnEndpointId": "cvpn-endpoint-123456789123abcde", 5 | "Description": "Endpoint for Admin access", 6 | "Status": { 7 | "Code": "available" 8 | }, 9 | "CreationTime": "2020-11-13T11:37:27", 10 | "DnsName": "*.cvpn-endpoint-123456789123abcde.prod.clientvpn.ap-south-1.amazonaws.com", 11 | "ClientCidrBlock": "172.31.0.0/16", 12 | "DnsServers": [ 13 | "8.8.8.8" 14 | ], 15 | "SplitTunnel": false, 16 | "VpnProtocol": "openvpn", 17 | "TransportProtocol": "udp", 18 | "VpnPort": 443, 19 | "ServerCertificateArn": "arn:aws:acm:ap-south-1:123456789012:certificate/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", 20 | "AuthenticationOptions": [ 21 | { 22 | "Type": "certificate-authentication", 23 | "MutualAuthentication": { 24 | "ClientRootCertificateChain": "arn:aws:acm:ap-south-1:123456789012:certificate/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE" 25 | } 26 | } 27 | ], 28 | "ConnectionLogOptions": { 29 | "Enabled": true, 30 | "CloudwatchLogGroup": "Client-vpn-connection-logs", 31 | "CloudwatchLogStream": "cvpn-endpoint-123456789123abcde-ap-south-1-2020/11/13-FCD8HEMVaCcw" 32 | }, 33 | "Tags": [ 34 | { 35 | "Key": "Name", 36 | "Value": "Client VPN" 37 | } 38 | ], 39 | "SecurityGroupIds": [ 40 | "sg-aabbcc11223344567" 41 | ], 42 | "VpcId": "vpc-a87f92c1", 43 | "SelfServicePortalUrl": "https://self-service.clientvpn.amazonaws.com/endpoints/cvpn-endpoint-123456789123abcde", 44 | "ClientConnectOptions": { 45 | "Enabled": false 46 | } 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /awsenum/apidef/normalize.py: -------------------------------------------------------------------------------- 1 | 2 | import logging 3 | import jsonschema 4 | import yaml 5 | import os 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | def normalize_api(api): 10 | _validate_api(api) 11 | 12 | for service, operations in api.items(): 13 | for operation, op_data in operations.items(): 14 | api[service][operation] = _normalize_operation( 15 | service, 16 | operation, 17 | op_data 18 | ) 19 | 20 | return api 21 | 22 | def _validate_api(api): 23 | schema = _load_api_schema() 24 | jsonschema.validate(api, schema) 25 | 26 | def _load_api_schema(): 27 | script_dir = os.path.dirname(os.path.abspath(__file__)) 28 | base_path = os.path.join(script_dir, "aws-apischema.yml") 29 | with open(base_path) as fi: 30 | return yaml.safe_load(fi) 31 | 32 | def _normalize_operation(service, operation, op_data): 33 | if not "allowed_client_error" in op_data: 34 | op_data["allowed_client_error"] = "" 35 | 36 | if not "outvars" in op_data: 37 | op_data["outvars"] = {} 38 | 39 | if "versions" not in op_data: 40 | op_data["versions"] = [{}] 41 | 42 | op_data["versions"] = _normalize_versions(op_data["versions"]) 43 | 44 | return op_data 45 | 46 | 47 | def _normalize_versions(versions): 48 | for i in range(len(versions)): 49 | versions[i] = _normalize_version(versions[i]) 50 | 51 | return versions 52 | 53 | def _normalize_version(version): 54 | if "scope" not in version: 55 | version["scope"] = "private" 56 | 57 | if "outvars" not in version: 58 | version["outvars"] = {} 59 | 60 | if "args" in version: 61 | args = version["args"] 62 | for arg_name in args: 63 | arg_value = args[arg_name] 64 | version["args"][arg_name] = _normalize_arg(arg_value) 65 | else: 66 | version["args"] = {} 67 | 68 | if "invar" not in version: 69 | version["invar"] = { 70 | "name": "", 71 | "mode": "single", 72 | } 73 | else: 74 | if isinstance(version["invar"], str): 75 | version["invar"] = { 76 | "name": version["invar"], 77 | "mode": "single", 78 | } 79 | elif "mode" not in version["invar"]: 80 | version["invar"]["mode"] = "single" 81 | 82 | return version 83 | 84 | def _normalize_arg(arg_value): 85 | mode = arg_value.get("mode", "single") 86 | 87 | if "value" in arg_value: 88 | return { 89 | "value": arg_value["value"], 90 | "mode": mode, 91 | } 92 | 93 | return { 94 | "mode": mode, 95 | "invar_path": arg_value["invar_path"], 96 | } 97 | 98 | -------------------------------------------------------------------------------- /awsenum/apidef/filters.py: -------------------------------------------------------------------------------- 1 | import fnmatch 2 | from abc import ABC, abstractmethod 3 | 4 | 5 | def create_service_filter( 6 | allowed_services=None, 7 | excluded_services=None, 8 | ): 9 | excluded_services = excluded_services or [] 10 | allowed_services = allowed_services or [] 11 | 12 | validators = [] 13 | 14 | if excluded_services: 15 | validators.append(NotFilter(ServiceFilter(excluded_services))) 16 | 17 | if allowed_services: 18 | validators.append(ServiceFilter(allowed_services)) 19 | 20 | return AndFilter(validators) 21 | 22 | 23 | def create_operation_filter( 24 | allowed_operations=None, 25 | excluded_operations=None, 26 | ): 27 | allowed_operations = allowed_operations or [] 28 | excluded_operations = excluded_operations or [] 29 | 30 | validators = [] 31 | 32 | if excluded_operations: 33 | validators.append(NotFilter(OperationFilter(excluded_operations))) 34 | 35 | if allowed_operations: 36 | validators.append(OperationFilter(allowed_operations)) 37 | 38 | return AndFilter(validators) 39 | 40 | 41 | def create_version_filter( 42 | scopes=None 43 | ): 44 | scopes = scopes or [] 45 | 46 | if scopes: 47 | return ScopeFilter(scopes) 48 | return TrueFilter() 49 | 50 | 51 | class Filter(ABC): 52 | 53 | @abstractmethod 54 | def filter(self, *args, **kwargs): 55 | pass 56 | 57 | @abstractmethod 58 | def __str__(self): 59 | pass 60 | 61 | def __repr__(self): 62 | return str(self) 63 | 64 | class TrueFilter(Filter): 65 | 66 | def filter(self, *args, **kwargs): 67 | return True 68 | 69 | def __str__(self): 70 | return "{}".format( 71 | self.__class__.__name__, 72 | ) 73 | 74 | class AndFilter(Filter): 75 | 76 | def __init__(self, subvalidators): 77 | super().__init__() 78 | self.subvalidators = subvalidators 79 | 80 | def filter(self, *args, **kwargs): 81 | for subvalidator in self.subvalidators: 82 | if not subvalidator.filter(*args, **kwargs): 83 | return False 84 | 85 | return True 86 | 87 | def __str__(self): 88 | return "{}({})".format( 89 | self.__class__.__name__, 90 | self.subvalidators 91 | ) 92 | 93 | class NotFilter(Filter): 94 | 95 | def __init__(self, subvalidator): 96 | super().__init__() 97 | self.subvalidator = subvalidator 98 | 99 | def filter(self, *args, **kwargs): 100 | return not self.subvalidator.filter(*args, **kwargs) 101 | 102 | def __str__(self): 103 | return "{}(not {})".format( 104 | self.__class__.__name__, 105 | self.subvalidator 106 | ) 107 | 108 | class ScopeFilter(Filter): 109 | 110 | def __init__(self, scopes): 111 | super().__init__() 112 | self.scopes = scopes 113 | 114 | def filter(self, version, *args, **kwargs): 115 | return version["scope"] in self.scopes 116 | 117 | def __str__(self): 118 | return "{}({})".format(self.__class__.__name__, self.scopes) 119 | 120 | class ServiceFilter(Filter): 121 | 122 | def __init__(self, services): 123 | super().__init__() 124 | self.services = services 125 | 126 | def filter(self, service, *args, **kwargs): 127 | return _there_is_some_fnmatch(service, self.services) 128 | 129 | def __str__(self): 130 | return "{}({})".format(self.__class__.__name__, self.services) 131 | 132 | class OperationFilter(Filter): 133 | 134 | def __init__(self, operations): 135 | super().__init__() 136 | self.operations = operations 137 | 138 | def filter(self, operation, *args, **kwargs): 139 | return _there_is_some_fnmatch(operation, self.operations) 140 | 141 | def __str__(self): 142 | return "{}({})".format(self.__class__.__name__, self.operations) 143 | 144 | 145 | def _there_is_some_fnmatch(name, filters): 146 | if not filters: 147 | return True 148 | 149 | for filt in filters: 150 | if fnmatch.fnmatch(name, filt): 151 | return True 152 | 153 | return False 154 | -------------------------------------------------------------------------------- /tests/test_out_variables.py: -------------------------------------------------------------------------------- 1 | import awsenum 2 | import json 3 | import os 4 | 5 | dir_path = os.path.dirname(__file__) 6 | 7 | api = awsenum.apidef.load_api() 8 | 9 | """ 10 | def test_ec2_describe_client_vpn_endpoints_out_variable(): 11 | value = extract_variable( 12 | "ec2", 13 | "describe_client_vpn_endpoints", 14 | "ec2_describe_client_vpn_endpoints" 15 | ) 16 | assert value == ["cvpn-endpoint-123456789123abcde"] 17 | 18 | def test_ec2_describe_vpcs_out_variable(): 19 | value = extract_variable( 20 | "ec2", 21 | "describe_vpcs", 22 | "ec2_describe_vpcs", 23 | ) 24 | assert value == ["vpc-0e9801d129EXAMPLE", "vpc-06e4ab6c6cEXAMPLE"] 25 | """ 26 | 27 | def test_amplifybackend_list_s3_buckets(): 28 | _test_out_variable_value( 29 | "amplifybackend", 30 | "list-s3-buckets", 31 | "s3-buckets-names", 32 | ) 33 | 34 | def test_ec2_describe_instances_out_variable(): 35 | _test_out_variable_value( 36 | "ec2", 37 | "describe-instances", 38 | "ec2-instances-ids", 39 | ) 40 | 41 | def test_ecs_list_clusters_out_variable(): 42 | _test_out_variable_value("ecs", "list-clusters", "ecs-clusters-arns") 43 | 44 | def test_ecs_list_tasks_out_variable(): 45 | _test_out_variable_value( 46 | "ecs", 47 | "list-tasks", 48 | "ecs-cluster-tasks", 49 | version=0 50 | ) 51 | 52 | def test_ecs_list_services_out_variable(): 53 | _test_out_variable_value("ecs", "list-services", "ecs-cluster-services") 54 | 55 | def test_iam_get_policy_out_variable(): 56 | _test_out_variable_value( 57 | "iam", 58 | "get-policy", 59 | "iam-policy-versions", 60 | variable_file="iam-policy-versions_get-policy" 61 | ) 62 | 63 | def test_iam_list_attached_role_policies_out_variable(): 64 | _test_out_variable_value( 65 | "iam", 66 | "list-attached-role-policies", 67 | "iam-policies-arns", 68 | variable_file="iam-policies-arns_list-attached-role-policies" 69 | ) 70 | 71 | def test_iam_list_policies_policies_arns_out_variable(): 72 | _test_out_variable_value("iam", "list-policies", "iam-policies-arns") 73 | 74 | def test_iam_list_policies_policies_versions_out_variable(): 75 | _test_out_variable_value( 76 | "iam", 77 | "list-policies", 78 | "iam-policies-versions", 79 | variable_file="iam-policies-versions_list-policies", 80 | ) 81 | 82 | def test_iam_list_policy_versions_out_variable(): 83 | _test_out_variable_value( 84 | "iam", 85 | "list-policy-versions", 86 | "iam-policy-versions" 87 | ) 88 | 89 | def test_iam_list_role_policies_out_variable(): 90 | _test_out_variable_value("iam", "list-role-policies", "iam-role-policies") 91 | 92 | def test_iam_list_roles_out_variable(): 93 | _test_out_variable_value("iam", "list-roles", "iam-rolenames") 94 | 95 | def test_iam_list_users(): 96 | _test_out_variable_value("iam", "list-users", "iam-usernames") 97 | 98 | def test_lambda_list_functions_out_variable(): 99 | _test_out_variable_value( 100 | "lambda", 101 | "list-functions", 102 | "lambda-functions-names" 103 | ) 104 | 105 | def test_s3_list_buckets(): 106 | _test_out_variable_value("s3", "list-buckets", "s3-buckets-names") 107 | 108 | 109 | def test_secretsmanager_list_secrets_out_variable(): 110 | _test_out_variable_value( 111 | "secretsmanager", 112 | "list-secrets", 113 | "secretsmanager-secrets-arns", 114 | ) 115 | 116 | def _test_out_variable_value( 117 | service, 118 | operation, 119 | varname, 120 | version=0, 121 | response_file=None, 122 | variable_file=None 123 | ): 124 | value = extract_variable( 125 | service, 126 | operation, 127 | varname, 128 | version=version, 129 | response_file=response_file 130 | ) 131 | assert value == load_variable(varname, variable_file) 132 | 133 | def extract_variable( 134 | service, 135 | operation, 136 | varname, 137 | version=0, 138 | response_file=None 139 | ): 140 | response_file = response_file or "{}-{}".format(service, operation) 141 | 142 | operation_obj = api[service][operation] 143 | varpath = operation_obj["versions"][version]["outvars"][varname] 144 | 145 | response = load_response_sample(response_file) 146 | return awsenum.brute.extract_variable_value( 147 | varpath, 148 | response 149 | ) 150 | 151 | def load_response_sample(name): 152 | filepath = os.path.join(dir_path, "samples/responses/{}.json".format(name)) 153 | return load_json(filepath) 154 | 155 | def load_variable(varname, filename=None): 156 | filename = filename or varname 157 | filepath = os.path.join( 158 | dir_path, "samples/variables/{}.json".format(filename) 159 | ) 160 | return load_json(filepath)[varname] 161 | 162 | 163 | def load_json(filepath): 164 | with open(filepath) as fi: 165 | return json.load(fi) 166 | -------------------------------------------------------------------------------- /tests/samples/responses/ec2-describe-instances.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": {}, 3 | "response": { 4 | "Reservations": [ 5 | { 6 | "ReservationId": "r-02a3f596d91211712", 7 | "OwnerId": "123456789012", 8 | "Instances": [ 9 | { 10 | "MetadataOptions": { 11 | "HttpEndpoint": "enabled", 12 | "HttpPutResponseHopLimit": 1, 13 | "HttpTokens": "optional", 14 | "State": "pending" 15 | }, 16 | "CapacityReservationSpecification": { 17 | "CapacityReservationPreference": "open" 18 | }, 19 | "CpuOptions": { 20 | "ThreadsPerCore": 1, 21 | "CoreCount": 1 22 | }, 23 | "VirtualizationType": "hvm", 24 | "Tags": [], 25 | "StateReason": { 26 | "Message": "pending", 27 | "Code": "pending" 28 | }, 29 | "SourceDestCheck": true, 30 | "SecurityGroups": [ 31 | { 32 | "GroupId": "sg-0598c7d356eba48d7", 33 | "GroupName": "MySecurityGroup" 34 | } 35 | ], 36 | "RootDeviceType": "ebs", 37 | "RootDeviceName": "/dev/xvda", 38 | "NetworkInterfaces": [ 39 | { 40 | "InterfaceType": "interface", 41 | "VpcId": "vpc-1234567890abcdef0", 42 | "SubnetId": "subnet-04a636d18e83cfacb", 43 | "Status": "in-use", 44 | "SourceDestCheck": true, 45 | "PrivateIpAddresses": [ 46 | { 47 | "PrivateIpAddress": "10.0.0.157", 48 | "PrivateDnsName": "ip-10-0-0-157.us-east-2.compute.internal", 49 | "Primary": true 50 | } 51 | ], 52 | "PrivateIpAddress": "10.0.0.157", 53 | "PrivateDnsName": "ip-10-0-0-157.us-east-2.compute.internal", 54 | "OwnerId": "123456789012", 55 | "NetworkInterfaceId": "eni-0c0a29997760baee7", 56 | "MacAddress": "0a:ab:58:e0:67:e2", 57 | "Ipv6Addresses": [], 58 | "Groups": [ 59 | { 60 | "GroupId": "sg-0598c7d356eba48d7", 61 | "GroupName": "MySecurityGroup" 62 | } 63 | ], 64 | "Description": "", 65 | "Attachment": { 66 | "Status": "attaching", 67 | "DeviceIndex": 0, 68 | "DeleteOnTermination": true, 69 | "AttachmentId": "eni-attach-0e325c07e928a0405", 70 | "AttachTime": "2018-05-10T08:05:20.000Z" 71 | } 72 | } 73 | ], 74 | "Hypervisor": "xen", 75 | "EbsOptimized": false, 76 | "ClientToken": "", 77 | "BlockDeviceMappings": [], 78 | "Architecture": "x86_64", 79 | "VpcId": "vpc-1234567890abcdef0", 80 | "SubnetId": "subnet-04a636d18e83cfacb", 81 | "StateTransitionReason": "", 82 | "State": { 83 | "Name": "pending", 84 | "Code": 0 85 | }, 86 | "PublicDnsName": "", 87 | "ProductCodes": [], 88 | "PrivateIpAddress": "10.0.0.157", 89 | "PrivateDnsName": "ip-10-0-0-157.us-east-2.compute.internal", 90 | "Placement": { 91 | "Tenancy": "default", 92 | "GroupName": "", 93 | "AvailabilityZone": "us-east-2a" 94 | }, 95 | "Monitoring": { 96 | "State": "disabled" 97 | }, 98 | "LaunchTime": "2018-05-10T08:05:20.000Z", 99 | "KeyName": "MyKeyPair", 100 | "InstanceType": "t2.micro", 101 | "InstanceId": "i-1234567890abcdef0", 102 | "ImageId": "ami-0abcdef1234567890", 103 | "AmiLaunchIndex": 0 104 | } 105 | ], 106 | "Groups": [] 107 | } 108 | ] 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /awsenum/args.py: -------------------------------------------------------------------------------- 1 | 2 | import argcomplete 3 | import argparse 4 | 5 | from . import awsaccount 6 | from . import apidef 7 | 8 | DEFAULT_CONNECT_TIMEOUT = 10000 9 | DEFAULT_READ_TIMEOUT = 60000 10 | DEFAULT_MAX_RETRIES = 2 11 | 12 | def ServiceCompleter(**kwargs): 13 | return apidef.list_all_base_services() 14 | 15 | def OperationCompleter(**kwargs): 16 | allowed_services = kwargs["parsed_args"].allowed_services 17 | excluded_services = kwargs["parsed_args"].excluded_services 18 | api_def = apidef.load_api( 19 | allowed_services=allowed_services, 20 | excluded_services=excluded_services, 21 | ) 22 | allowed_operations = [] 23 | for operations in api_def.values(): 24 | allowed_operations.extend(operations) 25 | 26 | return allowed_operations 27 | 28 | 29 | MAX_LEVEL_DEFAULT = "operation" 30 | 31 | def parse_args(): 32 | parser = argparse.ArgumentParser() 33 | 34 | parser.add_argument( 35 | "--access-key", 36 | help="Access key for the API. " 37 | "If provided, secret key is also required." 38 | ) 39 | 40 | parser.add_argument( 41 | "--secret-key", 42 | help="Secret key for the API." 43 | ) 44 | 45 | parser.add_argument( 46 | "--session-token", 47 | help="Token for the API session." 48 | ) 49 | 50 | parser.add_argument( 51 | "--profile", 52 | default="default", 53 | help="AWS profile to use in requests." 54 | ).completer = ProfileCompleter 55 | 56 | parser.add_argument( 57 | "--region", 58 | help="AWS region to inspect." 59 | ) 60 | 61 | parser.add_argument( 62 | "-s", "--service", 63 | help="Services to check. " 64 | "Wildcard can be used to match several services.", 65 | nargs="+", 66 | dest="allowed_services", 67 | metavar="SERVICE", 68 | ).completer = ServiceCompleter 69 | 70 | parser.add_argument( 71 | "--exclude-service", 72 | help="Exclude services from check." 73 | " Wildcard can be used to match several services.", 74 | nargs="+", 75 | dest="excluded_services", 76 | metavar="SERVICE", 77 | ).completer = ServiceCompleter 78 | 79 | parser.add_argument( 80 | "--operation", 81 | help="Operation to check." 82 | " Wildcard can be used to match several operations.", 83 | nargs="+", 84 | dest="allowed_operations", 85 | metavar="operation", 86 | ).completer = OperationCompleter 87 | 88 | parser.add_argument( 89 | "--exclude-operation", 90 | help="Exclude operations from check." 91 | " Wildcard can be used to match several operations.", 92 | nargs="+", 93 | dest="excluded_operations", 94 | metavar="operation", 95 | ).completer = OperationCompleter 96 | 97 | parser.add_argument( 98 | "--allow-public", 99 | help="Also check the operations that retrieve information not related" 100 | " with your account.", 101 | action="store_true", 102 | default=False, 103 | ) 104 | 105 | parser.add_argument( 106 | "--non-recursive", 107 | help="Avoid trigger new checks from results of others.", 108 | action="store_true", 109 | default=False, 110 | ) 111 | 112 | parser.add_argument( 113 | "--vars-file", 114 | help="File with variables to use as input declared." 115 | " Can be JSON or YAML format.", 116 | ) 117 | 118 | parser.add_argument( 119 | "-o", "--out", 120 | metavar="FILE", 121 | dest="results_filepath", 122 | help="File to write API calls results." 123 | " Default: awsenum-.json." 124 | ) 125 | 126 | parser.add_argument( 127 | "--workers", "-w", 128 | type=int, 129 | default=10, 130 | help="Number of concurrent workers/threads to make requests." 131 | ) 132 | 133 | parser.add_argument( 134 | "--connect-timeout", 135 | type=uint, 136 | default=DEFAULT_CONNECT_TIMEOUT, 137 | help="Request connection timeout, in milliseconds." 138 | " Default: {}.".format(DEFAULT_CONNECT_TIMEOUT), 139 | ) 140 | 141 | parser.add_argument( 142 | "--read-timeout", 143 | type=uint, 144 | default=DEFAULT_READ_TIMEOUT, 145 | help="Request read timeout, in milliseconds." 146 | " Default: {}.".format(DEFAULT_READ_TIMEOUT), 147 | ) 148 | 149 | parser.add_argument( 150 | "--max-retries", 151 | type=uint, 152 | default=DEFAULT_MAX_RETRIES, 153 | help="Number of retries after a timeout in request." 154 | " Default: {}.".format(DEFAULT_MAX_RETRIES) 155 | ) 156 | 157 | parser.add_argument( 158 | "--list", 159 | help="List the selected services, operations or versions to check," 160 | " instead of performing the enumeration.", 161 | nargs="?", 162 | choices=("service", "operation", "version"), 163 | 164 | # We suppress the argument by default so we can know when it is passed 165 | # by the user. So we have the following posibilites: 166 | # If list not in args namespace: not used. 167 | # If list is None: used without argument. 168 | # If list other: used with argument. 169 | default=argparse.SUPPRESS, 170 | ) 171 | 172 | parser.add_argument( 173 | "-v", 174 | dest="verbosity", 175 | action="count", 176 | default=0, 177 | help="Increase verbosity level." 178 | " -v: Info. -vv: Debug. -vvv: Debug libraries." 179 | ) 180 | 181 | argcomplete.autocomplete(parser) 182 | args = parser.parse_args() 183 | return args 184 | 185 | def ProfileCompleter(**kwargs): 186 | return awsaccount.list_profiles() 187 | 188 | def uint(v): 189 | try: 190 | v = int(v) 191 | if v < 0: 192 | raise ValueError("") 193 | except ValueError: 194 | raise argparse.ArgumentTypeError( 195 | "Must be a positive number" 196 | ) 197 | -------------------------------------------------------------------------------- /awsenum/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import logging 4 | 5 | from . import apidef as apidefmod 6 | from . import awsaccount 7 | from . import client as clientmod 8 | from . import args as argsmod 9 | from . import brute as brutemod 10 | from . import utils 11 | 12 | 13 | logger = logging.getLogger(__name__) 14 | 15 | def main(): 16 | try: 17 | _main() 18 | except KeyboardInterrupt: 19 | pass 20 | 21 | def _main(): 22 | args = argsmod.parse_args() 23 | init_log(args.verbosity) 24 | 25 | api = load_api_from_args(args) 26 | if not api: 27 | logger.error( 28 | "No operation was selected to test. " 29 | "Maybe you indicate an incorrect filter." 30 | ) 31 | return 32 | 33 | if "list" in args: 34 | main_inspect_api(args, api) 35 | else: 36 | main_brute(args, api) 37 | 38 | 39 | def init_log(verbosity=0, log_file=None): 40 | 41 | restrict_libraries_debug = True 42 | 43 | if verbosity == 1: 44 | level = logging.INFO 45 | elif verbosity > 1: 46 | level = logging.DEBUG 47 | if verbosity > 2: 48 | restrict_libraries_debug = False 49 | else: 50 | level = logging.WARN 51 | 52 | logging.basicConfig( 53 | level=level, 54 | filename=log_file, 55 | format="%(levelname)s:%(name)s:%(message)s" 56 | ) 57 | 58 | if restrict_libraries_debug: 59 | # Suppress boto INFO. 60 | logging.getLogger('boto3').setLevel(logging.WARNING) 61 | logging.getLogger('botocore').setLevel(logging.WARNING) 62 | logging.getLogger('nose').setLevel(logging.WARNING) 63 | 64 | logging.getLogger("requests").setLevel(logging.WARNING) 65 | logging.getLogger("urllib3").setLevel(logging.WARNING) 66 | 67 | 68 | def main_inspect_api(args, api): 69 | if args.list is not None: 70 | max_level = args.list 71 | else: 72 | max_level = "operation" 73 | 74 | for service_name, service in api.items(): 75 | if max_level == "service": 76 | print(service_name) 77 | continue 78 | 79 | for operation_name, operation in service.items(): 80 | if max_level == "operation": 81 | print(service_name, operation_name) 82 | continue 83 | 84 | for version in operation["versions"]: 85 | version_msg = [service_name, operation_name] 86 | scope = version["scope"] 87 | invar = version["invar"]["name"] 88 | outvars = version["outvars"].keys() 89 | 90 | version_msg.append("scope:{}".format(scope)) 91 | version_msg.append("invar:{}".format(invar)) 92 | version_msg.append("outvars:{}".format(",".join(outvars))) 93 | 94 | print(" ".join(version_msg)) 95 | 96 | 97 | 98 | def main_brute(args, api): 99 | try: 100 | account = awsaccount.resolve_aws_account( 101 | args.profile, 102 | access_key=args.access_key, 103 | secret_key=args.secret_key, 104 | session_token=args.session_token, 105 | region=args.region, 106 | ) 107 | except awsaccount.AccountError as e: 108 | logger.error(e) 109 | return 110 | 111 | logger.info("AWS Access key: %s", account.access_key) 112 | logger.info("Region: %s", account.region) 113 | 114 | client_provider = clientmod.ClientProvider( 115 | account, 116 | connect_timeout=args.connect_timeout/1000, 117 | read_timeout=args.read_timeout/1000, 118 | max_retries=args.max_retries, 119 | ) 120 | 121 | if logger.getEffectiveLevel() <= logging.INFO: 122 | user_id, user_account, arn = clientmod.get_caller_identity( 123 | client_provider 124 | ) 125 | logger.info("User ID: %s", user_id) 126 | logger.info("Account: %s", user_account) 127 | logger.info("ARN: %s", arn) 128 | 129 | if args.vars_file: 130 | try: 131 | variables = utils.load_yaml(args.vars_file) 132 | except OSError as e: 133 | logger.error( 134 | "Error opening variables file '%s': %s", 135 | args.vars_file, e 136 | ) 137 | return 138 | 139 | if not isinstance(variables, dict): 140 | logger.error( 141 | "Variables file '%s' must be a" 142 | " dictionary containing the variables", 143 | args.vars_file 144 | ) 145 | return 146 | else: 147 | variables = {} 148 | 149 | 150 | results = brutemod.brute( 151 | api, 152 | client_provider, 153 | variables, 154 | workers=args.workers, 155 | recurse=not args.non_recursive, 156 | ) 157 | 158 | if args.results_filepath: 159 | results_filepath = args.results_filepath 160 | else: 161 | results_filepath = "awsenum-{}.json".format( 162 | utils.now_datetime().strftime("%Y-%m-%d-%H-%M-%S") 163 | ) 164 | 165 | try: 166 | utils.save_json(results, results_filepath) 167 | except OSError as e: 168 | logging.error("Error saving results in '{}': {}".format( 169 | results_filepath, e 170 | )) 171 | 172 | 173 | 174 | COMMON_SERVICES = [ 175 | "acm", 176 | "acm-pca", 177 | "autoscaling", 178 | "cloudfront", 179 | "cognito-identity", 180 | "cognito-idp", 181 | "cognito-sync", 182 | "dynamodb", 183 | "ebs", 184 | "ec2", 185 | "ecs", 186 | "elasticache", 187 | "elasticbeanstalk", 188 | "glacier", 189 | "iam", 190 | "kinesis", 191 | "lambda", 192 | "lightsail", 193 | "rds", 194 | "s3", 195 | "sns", 196 | "sqs", 197 | ] 198 | 199 | def load_api_from_args(args): 200 | 201 | allowed_scopes = ["private"] 202 | if args.allow_public: 203 | allowed_scopes.append("public") 204 | 205 | allowed_services = args.allowed_services or COMMON_SERVICES 206 | 207 | return apidefmod.load_api( 208 | allowed_services=allowed_services, 209 | excluded_services=args.excluded_services, 210 | allowed_operations=args.allowed_operations, 211 | excluded_operations=args.excluded_operations, 212 | allowed_scopes=allowed_scopes, 213 | ) 214 | -------------------------------------------------------------------------------- /awsenum/operation.py: -------------------------------------------------------------------------------- 1 | import jmespath 2 | 3 | class PreOperation: 4 | """Contains the definition of the operation to be completed with the 5 | variable dependencies. 6 | """ 7 | 8 | def __init__( 9 | self, 10 | service, 11 | name, 12 | pre_args, 13 | out_variables, 14 | input_variable, 15 | allowed_client_error, 16 | ): 17 | self.service = service 18 | self.name = name 19 | self.pre_args = pre_args 20 | self.out_variables = out_variables 21 | self.input_variable = input_variable 22 | self.allowed_client_error = allowed_client_error 23 | 24 | def concretize(self, input_): 25 | return concretize_operations(self, input_) 26 | 27 | @property 28 | def input_mode(self): 29 | return self.input_variable.mode 30 | 31 | def __repr__(self): 32 | return str(self) 33 | 34 | def __str__(self): 35 | return "PreOperation: {} {} ({})".format( 36 | self.service, 37 | self.name, 38 | self.input_variable.name 39 | ) 40 | 41 | 42 | def get_pre_operations(api_def): 43 | 44 | for service, operations in api_def.items(): 45 | for op_name, op_data in operations.items(): 46 | 47 | for version in op_data["versions"]: 48 | op_args = version["args"] 49 | input_variable = InVar( 50 | version["invar"]["name"], 51 | version["invar"]["mode"], 52 | ) 53 | 54 | 55 | out_variables = [ 56 | OutVar(varname, varpath) 57 | for varname, varpath in version["outvars"].items() 58 | ] 59 | allowed_client_error = version["allowed_client_error"] 60 | 61 | yield PreOperation( 62 | service=service, 63 | name=op_name, 64 | pre_args=op_args, 65 | out_variables=out_variables, 66 | input_variable=input_variable, 67 | allowed_client_error=allowed_client_error, 68 | ) 69 | 70 | def concretize_operations(pre_operation, input_): 71 | if pre_operation.input_mode == "single": 72 | input_ = [input_] 73 | 74 | for element in input_: 75 | for args in concretize_args(pre_operation.pre_args, element): 76 | yield Operation( 77 | service=pre_operation.service, 78 | name=pre_operation.name, 79 | args=args, 80 | out_variables=pre_operation.out_variables, 81 | allowed_client_error=pre_operation.allowed_client_error, 82 | ) 83 | 84 | def concretize_args(pre_args, input_): 85 | if not pre_args: 86 | yield {} 87 | return 88 | 89 | args_list = [] 90 | for arg_name, arg_def in pre_args.items(): 91 | values = get_pre_arg_values(arg_def, input_) 92 | args_list.append({"name": arg_name, "values": values}) 93 | 94 | for args in args_cart_product(args_list): 95 | yield args 96 | 97 | 98 | def get_pre_arg_values(arg_def, input_): 99 | if "value" in arg_def: 100 | values = arg_def["value"] 101 | else: 102 | if arg_def["invar_path"]: 103 | values = jmespath.search(arg_def["invar_path"], input_) 104 | else: 105 | values = input_ 106 | 107 | if arg_def["mode"] != "foreach": 108 | values = [values] 109 | 110 | return values 111 | 112 | 113 | # Adapted version of https://stackoverflow.com/a/12658055 114 | def args_cart_product(args_list): 115 | bounds = [len(arg["values"]) for arg in args_list] 116 | 117 | for elem in lex_gen(bounds): 118 | yield { 119 | args_list[i]["name"]: args_list[i]["values"][elem[i]] 120 | for i in range(len(args_list)) 121 | } 122 | 123 | def lex_gen(bounds): 124 | # if at least one argument contains 0 values 125 | # then it is not possible to do the cartessian 126 | # product 127 | if 0 in bounds: 128 | return 129 | 130 | elem = [0] * len(bounds) 131 | while True: 132 | yield elem 133 | i = 0 134 | while elem[i] == bounds[i] - 1: 135 | elem[i] = 0 136 | i += 1 137 | if i == len(bounds): 138 | return 139 | elem[i] += 1 140 | 141 | class InVar: 142 | 143 | def __init__(self, name, mode): 144 | self.name = name 145 | self.mode = mode 146 | 147 | class OutVar: 148 | 149 | def __init__(self, name, path): 150 | self.name = name 151 | self.path = path 152 | 153 | 154 | class Operation: 155 | """The concrete operation with the definitive arguments 156 | 157 | The attributes of this class cannot be changed once created, in order to 158 | hash work properly. 159 | """ 160 | 161 | def __init__( 162 | self, 163 | service, 164 | name, 165 | args, 166 | out_variables, 167 | allowed_client_error 168 | ): 169 | self._service = service 170 | self._name = name 171 | self._args = args 172 | self.out_variables = out_variables 173 | self.allowed_client_error = allowed_client_error 174 | 175 | @property 176 | def service(self): 177 | return self._service 178 | 179 | @property 180 | def name(self): 181 | return self._name 182 | 183 | @property 184 | def args(self): 185 | return self._args 186 | 187 | @property 188 | def args_str(self): 189 | if not self.args: 190 | return "" 191 | 192 | args_str = [] 193 | for k, v in self.args.items(): 194 | args_str.append("{}={}".format(k, v)) 195 | return "({})".format(",".join(args_str)) 196 | 197 | @property 198 | def id(self): 199 | if self.args_str: 200 | return "{}.{} {}".format( 201 | self.service, self.name, self.args_str 202 | ) 203 | 204 | return "{}.{}".format( 205 | self.service, self.name 206 | ) 207 | 208 | def __repr__(self): 209 | return str(self) 210 | 211 | def __str__(self): 212 | return self.id 213 | 214 | def __hash__(self): 215 | return hash(( 216 | self.service, 217 | self.name, 218 | make_hashable(self.args) 219 | )) 220 | 221 | def __eq__(self, other): 222 | return self.service == other.service \ 223 | and self.name == other.name \ 224 | and self.args == other.args 225 | 226 | def make_hashable(obj): 227 | if isinstance(obj, list): 228 | return tuple(sorted([make_hashable(item) for item in obj])) 229 | 230 | if isinstance(obj, dict): 231 | hashable_dict = {} 232 | for k, v in obj.items(): 233 | hashable_dict[k] = make_hashable(v) 234 | return tuple(sorted(hashable_dict)) 235 | 236 | return obj 237 | -------------------------------------------------------------------------------- /awsenum/brute.py: -------------------------------------------------------------------------------- 1 | 2 | from concurrent.futures import ThreadPoolExecutor, as_completed 3 | import jmespath 4 | import logging 5 | import botocore 6 | from itertools import chain 7 | 8 | from . import operation as opmod 9 | 10 | logger = logging.getLogger(__name__) 11 | 12 | 13 | def brute(api, client_provider, variables, workers=10, recurse=True): 14 | pre_operations = get_api_pre_operations_per_invar(api) 15 | 16 | empty_variable = ("", {}) 17 | new_operations = resolve_dependencies( 18 | pre_operations, 19 | chain((empty_variable,), variables.items()) 20 | ) 21 | 22 | if not recurse: 23 | pre_operations = {} 24 | 25 | pool = ThreadPoolExecutor(workers) 26 | results = {} 27 | 28 | tested_operations = set() 29 | 30 | try: 31 | while new_operations: 32 | ready_operations = [] 33 | for op in new_operations: 34 | if op not in tested_operations: 35 | tested_operations.add(op) 36 | ready_operations.append(op) 37 | 38 | new_results, new_operations = run_brute_iteration( 39 | pool, 40 | client_provider, 41 | ready_operations, 42 | pre_operations, 43 | ) 44 | results.update(new_results) 45 | 46 | except KeyboardInterrupt: 47 | pass 48 | 49 | return results 50 | 51 | 52 | def get_api_pre_operations_per_invar(api): 53 | pre_operations = {"": []} 54 | 55 | for pre_operation in opmod.get_pre_operations(api): 56 | invar_name = pre_operation.input_variable.name 57 | try: 58 | pre_operations[invar_name].append(pre_operation) 59 | except KeyError: 60 | pre_operations[invar_name] = [pre_operation] 61 | 62 | return pre_operations 63 | 64 | def resolve_dependencies(pre_operations, variables): 65 | operations = [] 66 | for var_name, var_value in variables: 67 | operations.extend( 68 | resolve_dependency(pre_operations, var_name, var_value) 69 | ) 70 | return operations 71 | 72 | def resolve_dependency(pre_operations, var_name, var_value): 73 | if var_name not in pre_operations.keys(): 74 | return [] 75 | 76 | ready_operations = [] 77 | for pre_operation in pre_operations[var_name]: 78 | ready_operations.extend(pre_operation.concretize(var_value)) 79 | 80 | return ready_operations 81 | 82 | class Variable: 83 | 84 | def __init__(self, name, value): 85 | self.name = name 86 | self.value = value 87 | 88 | def run_brute_iteration( 89 | pool, 90 | client_provider, 91 | operations, 92 | pre_operations, 93 | ): 94 | threads = [] 95 | results = {} 96 | for operation in operations: 97 | t = pool.submit(check_operation, client_provider, operation) 98 | threads.append(t) 99 | 100 | new_operations = [] 101 | 102 | try: 103 | for check_op in as_completed(threads): 104 | try: 105 | operation, response = check_op.result() 106 | print("{} {} {}".format( 107 | operation.service, operation.name, operation.args_str 108 | )) 109 | results[operation.id] = response 110 | 111 | for out_variable in operation.out_variables: 112 | variable = extract_variable( 113 | out_variable, 114 | {"args": operation.args, "response": response}, 115 | ) 116 | logger.debug( 117 | "%s outvar: %s=%s", 118 | operation.id, variable.name, variable.value 119 | ) 120 | 121 | new_operations.extend(resolve_dependency( 122 | pre_operations, variable.name, variable.value 123 | )) 124 | 125 | except CheckOperationError as ex: 126 | handle_check_operation_error(ex) 127 | 128 | except KeyboardInterrupt: 129 | new_operations = [] 130 | 131 | return results, new_operations 132 | 133 | 134 | def handle_check_operation_error(check_error): 135 | operation = check_error.operation 136 | try: 137 | raise check_error.inner_error 138 | except ( 139 | botocore.exceptions.ParamValidationError, 140 | botocore.exceptions.ClientError, 141 | botocore.exceptions.EndpointConnectionError, 142 | ) as e: 143 | logger.debug("Error {} in {}: {}".format( 144 | get_class_path(e), 145 | operation.id, 146 | e 147 | )) 148 | 149 | except KeyboardInterrupt: 150 | raise 151 | 152 | except Exception as e: 153 | logger.warning("Error {} in {}: {}".format( 154 | get_class_path(e), 155 | operation.id, 156 | e 157 | )) 158 | 159 | def is_connection_error(e): 160 | return isinstance(e, botocore.exceptions.EndpointConnectionError) or \ 161 | isinstance(e, botocore.exceptions.ConnectTimeoutError) 162 | 163 | return False 164 | 165 | # we use this method since there are classes that are defined in 166 | # runtime and isinstance doesn't allow to compare 167 | def get_class_path(obj): 168 | return "{}.{}".format(obj.__class__.__module__, obj.__class__.__name__) 169 | 170 | 171 | def extract_variable(out_variable, response): 172 | name = out_variable.name 173 | value = extract_variable_value(out_variable.path, response) 174 | return Variable(name, value) 175 | 176 | def extract_variable_value(path, response): 177 | return jmespath.search(path, response) 178 | 179 | 180 | def check_operation(client_provider, operation): 181 | try: 182 | client = client_provider.get_client(operation.service) 183 | 184 | logger.info("Testing {} {} {}".format( 185 | operation.service, operation.name, operation.args_str 186 | )) 187 | 188 | py_op_name = operation.name.replace("-", "_") 189 | 190 | if client.can_paginate(py_op_name): 191 | paginator = client.get_paginator(py_op_name) 192 | response = paginator.paginate(**operation.args).build_full_result() 193 | else: 194 | response = getattr(client, py_op_name)(**operation.args) 195 | 196 | return operation, remove_response_metadata(response) 197 | except botocore.exceptions.ClientError as e: 198 | if operation.allowed_client_error: 199 | error_code = e.response.get('Error', {}).get('Code', 'Unknown') 200 | if error_code == operation.allowed_client_error: 201 | return operation, {} 202 | 203 | raise CheckOperationError(operation, e) 204 | except Exception as e: 205 | raise CheckOperationError(operation, e) 206 | 207 | class CheckOperationError(Exception): 208 | 209 | def __init__(self, operation, inner_error): 210 | super().__init__(str(inner_error)) 211 | self.operation = operation 212 | self.inner_error = inner_error 213 | 214 | 215 | def remove_response_metadata(response): 216 | try: 217 | del response["ResponseMetadata"] 218 | except KeyError: 219 | pass 220 | return response 221 | -------------------------------------------------------------------------------- /tests/samples/responses/iam-list-roles.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": { 3 | "Roles": [ 4 | { 5 | "RoleName": "AWSServiceRoleForECS", 6 | "RoleId": "AROAXY5COEUBQFBB44UHV", 7 | "Path": "/aws-service-role/ecs.amazonaws.com/", 8 | "MaxSessionDuration": 3600, 9 | "Description": "Role to enable Amazon ECS to manage your cluster.", 10 | "CreateDate": "2022-03-31 06:20:52+00:00", 11 | "AssumeRolePolicyDocument": { 12 | "Version": "2012-10-17", 13 | "Statement": [ 14 | { 15 | "Principal": { 16 | "Service": "ecs.amazonaws.com" 17 | }, 18 | "Effect": "Allow", 19 | "Action": "sts:AssumeRole" 20 | } 21 | ] 22 | }, 23 | "Arn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS" 24 | }, 25 | { 26 | "RoleName": "AWSServiceRoleForElasticLoadBalancing", 27 | "RoleId": "AROAXY5COEUBSVL274ZXV", 28 | "Path": "/aws-service-role/elasticloadbalancing.amazonaws.com/", 29 | "MaxSessionDuration": 3600, 30 | "Description": "Allows ELB to call AWS services on your behalf.", 31 | "CreateDate": "2022-04-06 05:41:44+00:00", 32 | "AssumeRolePolicyDocument": { 33 | "Version": "2012-10-17", 34 | "Statement": [ 35 | { 36 | "Principal": { 37 | "Service": "elasticloadbalancing.amazonaws.com" 38 | }, 39 | "Effect": "Allow", 40 | "Action": "sts:AssumeRole" 41 | } 42 | ] 43 | }, 44 | "Arn": "arn:aws:iam::123456789012:role/aws-service-role/elasticloadbalancing.amazonaws.com/AWSServiceRoleForElasticLoadBalancing" 45 | }, 46 | { 47 | "RoleName": "AWSServiceRoleForRDS", 48 | "RoleId": "AROAXY5COEUBUCRJIV44X", 49 | "Path": "/aws-service-role/rds.amazonaws.com/", 50 | "MaxSessionDuration": 3600, 51 | "Description": "Allows Amazon RDS to manage AWS resources on your behalf", 52 | "CreateDate": "2022-04-06 05:41:43+00:00", 53 | "AssumeRolePolicyDocument": { 54 | "Version": "2012-10-17", 55 | "Statement": [ 56 | { 57 | "Principal": { 58 | "Service": "rds.amazonaws.com" 59 | }, 60 | "Effect": "Allow", 61 | "Action": "sts:AssumeRole" 62 | } 63 | ] 64 | }, 65 | "Arn": "arn:aws:iam::123456789012:role/aws-service-role/rds.amazonaws.com/AWSServiceRoleForRDS" 66 | }, 67 | { 68 | "RoleName": "AWSServiceRoleForSupport", 69 | "RoleId": "AROAXY5COEUBYR5CMOB7O", 70 | "Path": "/aws-service-role/support.amazonaws.com/", 71 | "MaxSessionDuration": 3600, 72 | "Description": "Enables resource access for AWS to provide billing, administrative and support services", 73 | "CreateDate": "2021-02-11 18:33:54+00:00", 74 | "AssumeRolePolicyDocument": { 75 | "Version": "2012-10-17", 76 | "Statement": [ 77 | { 78 | "Principal": { 79 | "Service": "support.amazonaws.com" 80 | }, 81 | "Effect": "Allow", 82 | "Action": "sts:AssumeRole" 83 | } 84 | ] 85 | }, 86 | "Arn": "arn:aws:iam::123456789012:role/aws-service-role/support.amazonaws.com/AWSServiceRoleForSupport" 87 | }, 88 | { 89 | "RoleName": "AWSServiceRoleForTrustedAdvisor", 90 | "RoleId": "AROAXY5COEUBVQLGGZ7H7", 91 | "Path": "/aws-service-role/trustedadvisor.amazonaws.com/", 92 | "MaxSessionDuration": 3600, 93 | "Description": "Access for the AWS Trusted Advisor Service to help reduce cost, increase performance, and improve security of your AWS environment.", 94 | "CreateDate": "2021-02-11 18:33:54+00:00", 95 | "AssumeRolePolicyDocument": { 96 | "Version": "2012-10-17", 97 | "Statement": [ 98 | { 99 | "Principal": { 100 | "Service": "trustedadvisor.amazonaws.com" 101 | }, 102 | "Effect": "Allow", 103 | "Action": "sts:AssumeRole" 104 | } 105 | ] 106 | }, 107 | "Arn": "arn:aws:iam::123456789012:role/aws-service-role/trustedadvisor.amazonaws.com/AWSServiceRoleForTrustedAdvisor" 108 | }, 109 | { 110 | "RoleName": "cg-lambda-invoker-vulnerable_lambda_cgidqhlz86ajy2", 111 | "RoleId": "AROAXY5COEUB2MCVTFDWK", 112 | "Path": "/", 113 | "MaxSessionDuration": 3600, 114 | "CreateDate": "2022-06-13 06:19:56+00:00", 115 | "AssumeRolePolicyDocument": { 116 | "Version": "2012-10-17", 117 | "Statement": [ 118 | { 119 | "Sid": "", 120 | "Principal": { 121 | "AWS": "arn:aws:iam::123456789012:user/cg-bilbo-vulnerable_lambda_cgidqhlz86ajy2" 122 | }, 123 | "Effect": "Allow", 124 | "Action": "sts:AssumeRole" 125 | } 126 | ] 127 | }, 128 | "Arn": "arn:aws:iam::123456789012:role/cg-lambda-invoker-vulnerable_lambda_cgidqhlz86ajy2" 129 | }, 130 | { 131 | "RoleName": "vulnerable_lambda_cgidqhlz86ajy2-policy_applier_lambda1", 132 | "RoleId": "AROAXY5COEUBUTCJUBWA6", 133 | "Path": "/", 134 | "MaxSessionDuration": 3600, 135 | "CreateDate": "2022-06-13 06:19:39+00:00", 136 | "AssumeRolePolicyDocument": { 137 | "Version": "2012-10-17", 138 | "Statement": [ 139 | { 140 | "Sid": "", 141 | "Principal": { 142 | "Service": "lambda.amazonaws.com" 143 | }, 144 | "Effect": "Allow", 145 | "Action": "sts:AssumeRole" 146 | } 147 | ] 148 | }, 149 | "Arn": "arn:aws:iam::123456789012:role/vulnerable_lambda_cgidqhlz86ajy2-policy_applier_lambda1" 150 | } 151 | ] 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /awsenum/apidef/load.py: -------------------------------------------------------------------------------- 1 | 2 | import logging 3 | import os 4 | import botocore 5 | import botocore.loaders 6 | from .normalize import normalize_api 7 | from . import filters 8 | from .. import utils 9 | 10 | 11 | logger = logging.getLogger(__name__) 12 | 13 | 14 | def load_api( 15 | allowed_services=None, 16 | excluded_services=None, 17 | allowed_operations=None, 18 | excluded_operations=None, 19 | allowed_scopes=None, 20 | ): 21 | service_filter = filters.create_service_filter( 22 | allowed_services=allowed_services, 23 | excluded_services=excluded_services, 24 | ) 25 | 26 | operation_filter = filters.create_operation_filter( 27 | allowed_operations=allowed_operations, 28 | excluded_operations=excluded_operations, 29 | ) 30 | 31 | version_filter = filters.create_version_filter( 32 | scopes=allowed_scopes 33 | ) 34 | 35 | api = _load_api( 36 | service_filter=service_filter, 37 | operation_filter=operation_filter, 38 | version_filter=version_filter, 39 | ) 40 | 41 | return api 42 | 43 | 44 | def _load_api( 45 | service_filter, 46 | operation_filter, 47 | version_filter 48 | ): 49 | 50 | # we filter each part of the API individually and incrementally 51 | # (service, operation, version) so we reduce the loading time 52 | # which is specially helpful to avoid lag in command completion 53 | 54 | base = _load_base( 55 | service_filter=service_filter, 56 | operation_filter=operation_filter, 57 | ) 58 | 59 | # we also filter the service and operations in meta_api so we don't get 60 | # warnings for adding operations that are not in the base API, we don't 61 | # filter versions yet since if we do, we don't know when normalize if no 62 | # versions were specified or weren't create, so normalization will recreate 63 | # them all again, and versions filtered for public scope will be recreated 64 | metadata = _load_metadata( 65 | service_filter=service_filter, 66 | operation_filter=operation_filter, 67 | ) 68 | 69 | api = normalize_api(_build_api(base, metadata)) 70 | # once we have the final API, we filter the versions 71 | api = _filter_api_versions( 72 | api, 73 | version_filter=version_filter 74 | ) 75 | 76 | api = _set_all_info_in_versions(api) 77 | 78 | return api 79 | 80 | 81 | def _set_all_info_in_versions(api): 82 | for _, operations in api.items(): 83 | for _, op_data in operations.items(): 84 | allowed_client_error = op_data.pop("allowed_client_error") 85 | op_outvars = op_data.pop("outvars") 86 | 87 | for version in op_data["versions"]: 88 | version["allowed_client_error"] = allowed_client_error 89 | 90 | for varname, varpath in op_outvars.items(): 91 | if varname not in version["outvars"]: 92 | version["outvars"][varname] = varpath 93 | 94 | 95 | return api 96 | 97 | 98 | def _load_base(service_filter, operation_filter): 99 | base = {} 100 | for service in list_base_services(service_filter=service_filter): 101 | base[service] = list_base_service_operations( 102 | service, 103 | operation_filter=operation_filter 104 | ) 105 | 106 | return base 107 | 108 | def list_base_services(service_filter): 109 | return [ 110 | s 111 | for s in list_all_base_services() 112 | if service_filter.filter(service=s) 113 | ] 114 | 115 | def list_all_base_services(): 116 | return botocore.loaders.Loader().list_available_services("service-2") 117 | 118 | def list_base_service_operations(service, operation_filter): 119 | return [ 120 | op 121 | for op in _list_all_base_service_operations(service) 122 | if operation_filter.filter(operation=op) 123 | ] 124 | 125 | def _list_all_base_service_operations(service): 126 | loader = botocore.loaders.Loader() 127 | api_version = loader.determine_latest_version(service, "service-2") 128 | full_path = os.path.join(service, api_version, "service-2") 129 | 130 | operations = [ 131 | botocore.xform_name(op, "-") 132 | for op in loader.load_data(full_path).get("operations", []) 133 | ] 134 | 135 | return [op for op in operations if _is_read_operation(op)] 136 | 137 | def _is_read_operation(operation): 138 | for read_prefix in READ_OPERATION_PREFIXES: 139 | if operation.startswith(read_prefix): 140 | return True 141 | 142 | return False 143 | 144 | 145 | READ_OPERATION_PREFIXES = { 146 | "list-", 147 | "describe-", 148 | "get-", 149 | "search", 150 | "select", 151 | "query", 152 | } 153 | 154 | def _build_api(base, metadata): 155 | 156 | api = {} 157 | for service, operations in base.items(): 158 | api[service] = {} 159 | for operation in operations: 160 | api[service][operation] = {} 161 | 162 | for service, operations in metadata.items(): 163 | if service not in api: 164 | logger.warning( 165 | "%s service is not present in the base API", 166 | service 167 | ) 168 | continue 169 | 170 | for operation, op_data in operations.items(): 171 | if operation not in api[service]: 172 | logger.warning( 173 | "%s %s operation is not present in the base API", 174 | service, operation 175 | ) 176 | continue 177 | 178 | api[service][operation] = op_data 179 | 180 | return api 181 | 182 | def _load_metadata( 183 | service_filter, 184 | operation_filter, 185 | ): 186 | meta_api = _load_metadata_file() 187 | meta_api = _filter_metadata( 188 | meta_api, 189 | service_filter=service_filter, 190 | operation_filter=operation_filter, 191 | ) 192 | return meta_api 193 | 194 | 195 | 196 | def _load_metadata_file(): 197 | script_dir = os.path.dirname(os.path.abspath(__file__)) 198 | meta_path = os.path.join(script_dir, "api-meta.yml") 199 | return normalize_api(utils.load_yaml(meta_path)) 200 | 201 | 202 | def _filter_metadata( 203 | api, 204 | service_filter, 205 | operation_filter, 206 | ): 207 | 208 | logger.debug("Service filter: %s", service_filter) 209 | logger.debug("Operation filter: %s", operation_filter) 210 | 211 | filtered_api = {} 212 | for service, operations in api.items(): 213 | if not service_filter.filter(service=service): 214 | continue 215 | 216 | allowed_operations = {} 217 | for operation, op_data in operations.items(): 218 | if not operation_filter.filter(operation=operation): 219 | continue 220 | 221 | allowed_operations[operation] = op_data 222 | 223 | if allowed_operations: 224 | filtered_api[service] = allowed_operations 225 | 226 | return filtered_api 227 | 228 | 229 | def _filter_api_versions( 230 | api, 231 | version_filter, 232 | ): 233 | logger.debug("Version filter: %s", version_filter) 234 | 235 | filtered_api = {} 236 | for service, operations in api.items(): 237 | allowed_operations = {} 238 | for operation, op_data in operations.items(): 239 | op_data["versions"] = [ 240 | version 241 | for version in op_data["versions"] 242 | if version_filter.filter(version=version) 243 | ] 244 | 245 | if op_data["versions"]: 246 | allowed_operations[operation] = op_data 247 | 248 | if allowed_operations: 249 | filtered_api[service] = allowed_operations 250 | 251 | return filtered_api 252 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # awsenum 2 | 3 | awsenum is a tool to identify what permissions your account has in AWS by bruteforcing the different operations and check what can you perform. It is only limited to read operations. 4 | 5 | ## Installation 6 | 7 | ``` 8 | git clone https://github.com/zer1t0/awsenum 9 | cd awsenum/ 10 | pip install . 11 | ``` 12 | 13 | ## Add bash completion 14 | 15 | For the current user: 16 | ``` 17 | register-python-argcomplete awsenum >> ~/.bashrc 18 | ``` 19 | 20 | For the current session: 21 | ``` 22 | eval "$(register-python-argcomplete awsenum)" 23 | ``` 24 | 25 | ## Usage examples 26 | 27 | Enumerate the most common services: 28 | ``` 29 | awsenum 30 | ``` 31 | 32 | Enumerate with alternative AWS profile: 33 | ``` 34 | awsenum --profile johnny 35 | ``` 36 | 37 | ### Selecting services and operations 38 | 39 | In case you want so select the services you want to check, you can use the `-s/--service` and `--exclude-service` parameters. Here are some examples: 40 | 41 | Enumerate all the AWS services: 42 | ``` 43 | awsenum -s '*' 44 | ``` 45 | 46 | Enumerate one service: 47 | ``` 48 | awsenum -s s3 49 | ``` 50 | 51 | Enumerate family of services: 52 | ``` 53 | awsenum -s 'sagemaker*' 54 | ``` 55 | 56 | Enumerate several services: 57 | ``` 58 | awsenum -s ec2 s3 59 | ``` 60 | 61 | You can also select specific operations per service with `--operation` and `--exclude-operation`. For example to only list s3 buckets: 62 | ``` 63 | awsenum -s ec2 --operation 'describe-*' 64 | ``` 65 | 66 | ### Inspecting checked services and operations 67 | 68 | If you want to know what operations are going to be checked, you can use the `--list` parameter with any of the previous filters to list the selected operations, rather than actually do the check: 69 | 70 | ``` 71 | $ awsenum -s s3 --operation 'list-*' --list 72 | s3 list-bucket-analytics-configurations 73 | s3 list-bucket-intelligent-tiering-configurations 74 | s3 list-bucket-inventory-configurations 75 | s3 list-bucket-metrics-configurations 76 | s3 list-buckets 77 | s3 list-multipart-uploads 78 | s3 list-object-versions 79 | s3 list-objects 80 | s3 list-objects-v2 81 | s3 list-parts 82 | ``` 83 | 84 | You can also only list the services, to for example, know what services are checked by default (this list may change in the future): 85 | 86 | ``` 87 | $ awsenum --list service 88 | acm 89 | acm-pca 90 | autoscaling 91 | cloudfront 92 | cognito-identity 93 | cognito-idp 94 | cognito-sync 95 | dynamodb 96 | ebs 97 | ec2 98 | ecs 99 | elasticache 100 | elasticbeanstalk 101 | glacier 102 | iam 103 | kinesis 104 | lambda 105 | lightsail 106 | rds 107 | s3 108 | sns 109 | sqs 110 | ``` 111 | 112 | ### Using variables 113 | 114 | As you may know, some AWS operation need parameters to retrieve information, for example `list-objects` from a s3 bucket needs the bucket name. This information can be retrieved from other API operations like s3 `list-buckets` (and even from others like amplifybackend `list-s3-buckets`). Therefore, the result of some operation calls is stored in variables that can be used for other operation calls. You can see it like a publish-subscribe flow. 115 | 116 | In this example, the `list-buckets` operation will store the buckets names on the `s3-buckets-names` variable, which will be used by `list-objects` to enumerate the objects of each bucket. 117 | 118 | What happens is the next: 119 | 120 | ``` 121 | s3:list-buckets --> s3-buckets-names --.--> s3:list-objects (Bucket=test1) 122 | ["test1", "test2"] | 123 | '--> s3:list-objects (Bucket=test2) 124 | ``` 125 | 126 | So the result will be something like this: 127 | ``` 128 | $ awsenum -s s3 --operation list-buckets list-objects 129 | s3 list-buckets 130 | s3 list-objects (Bucket=test1) 131 | s3 list-objects (Bucket=test2) 132 | ``` 133 | 134 | You can check the operation that generates and consumes each variable by using the `--list version` parameter. 135 | 136 | ``` 137 | $ awsenum -s s3 --operation list-buckets list-objects --list version 138 | s3 list-buckets scope:private invar: outvars:s3-buckets-names 139 | s3 list-objects scope:private invar:s3-buckets-names outvars: 140 | ``` 141 | 142 | You also can pass a variable from a json file if you want. For example, to check if you have access to some s3 buckets, you can create a file with the following content: 143 | ``` 144 | { 145 | "s3-buckets-names": [ 146 | "test1", 147 | "test2" 148 | ] 149 | } 150 | ``` 151 | 152 | And then pass it to the program and select the proper operation: 153 | ``` 154 | $ awsenum -s s3 --operation list-objects-v2 --vars-file variables.json 155 | s3 list-objects-v2 (Bucket=test2joadijfoisadjiofjd) 156 | s3 list-objects-v2 (Bucket=testaskldfjaiopsdcnoidc) 157 | ``` 158 | 159 | 160 | ## The API meta 161 | 162 | The relations between AWS API operations (by using variables) are specified in the `api-meta.yml` file. This file includes information about each operation so the program can process it correctly. 163 | 164 | In the file there are 3 main types of items in hierarchy: 165 | 166 | - The AWS services (like s3, ec2, ...) 167 | - The operations (like list-buckets, describe-instances, ...) 168 | - The operation versions 169 | 170 | The operation versions are the different variations of a operation based on its parameters. For example, the iam get-user operation can receive or not an username as parameter, so it has two versions, like the following: 171 | 172 | ```yaml 173 | get-user: 174 | versions: 175 | - {} 176 | - invar: iam-usernames 177 | args: 178 | UserName: 179 | invar_path: "" 180 | mode: foreach 181 | ``` 182 | 183 | This indicates that the `get-user` operation has two versions, an empty version that means it receives no parameters, and a version that depends on the variable `iam-usernames` (that is a list of usernames). The empty version is the default in case none version is specified, but if you specified another version, you have to declare the empty version explicitly, in case you want use it. 184 | 185 | In the second version there is the argument `UserName` with the mode `foreach`, thus this argument will take each of the username of the list and tested it in different calls, instead of set `UserName` parameter as a list of usernames. The other interesting parameter here is `invar_path` that indicates the [jmespath](https://jmespath.org/) used to take the value of the parameter from the variable, in this case is empty since we want take the full value (for each username). 186 | 187 | It is also possible to specify a mode in the invar variable, in case is needed. For example if we have the following variable: 188 | ```json 189 | { 190 | "iam-policies-versions": [ 191 | { 192 | "versions": [ 193 | "v2" 194 | "v1" 195 | ], 196 | "policy": "arn:aws:iam::123456789012:policy/test-policy" 197 | }, 198 | { 199 | "versions": [ 200 | "v1", 201 | ], 202 | "policy": "arn:aws:iam::123456789012:policy/admin-policy" 203 | } 204 | ] 205 | } 206 | ``` 207 | 208 | We may need to iterate over each policy and then over each version of policy in order to get pairs policy-version. This is the case in `get-policy-version`, so we specify the `foreach` mode in the variable. 209 | 210 | ```yaml 211 | get-policy-version: 212 | versions: 213 | .. # stripped 214 | - invar: 215 | name: iam-policies-versions 216 | mode: foreach 217 | args: 218 | PolicyArn: 219 | invar_path: "policy" 220 | mode: single 221 | 222 | VersionId: 223 | invar_path: "versions" 224 | mode: foreach 225 | ``` 226 | 227 | In this case, we iterate over each policy of the variable and for the `PolicyArn` parameter we take the `policy` keyword as a whole (`single` mode) and we iterate over each value in `versions` and take each one for VersionId, for testing in a different call. So in this case we will finish with the following combinations: 228 | 229 | - PolicyArn=arn:aws:iam::123456789012:policy/test-policy VersionId=v1 230 | - PolicyArn=arn:aws:iam::123456789012:policy/test-policy VersionId=v2 231 | - PolicyArn=arn:aws:iam::123456789012:policy/admin-policy VersionId=v1 232 | 233 | 234 | Going back to the usernames case, the `iam-usernames` variable is created by `list-users` as is shown next: 235 | ```yaml 236 | list-users: 237 | outvars: 238 | iam-usernames: "response.Users[].UserName" 239 | ``` 240 | 241 | In this case, the `list-users` has no explicit versions declared, so an empty version will be used by default, without parameters. But what is interesting is that `list-users`, in case of being successful, will generate the variable `iam-usernames`. This is specified in the `outvars` section which specifies the variable name and the jmespath used to built in base on the response. The `outvars` section can be specified by version or by operation, in this last case will apply to all its versions. 242 | 243 | So if we want to list the usernames and try to get each one, we will get the following output: 244 | ``` 245 | $ awsenum -s iam --operation list-users get-user 246 | iam list-users 247 | iam get-user 248 | iam get-user (UserName=Administrator) 249 | iam get-user (UserName=iamtest) 250 | ``` 251 | 252 | You should also notice the `response` field as root in the `iam-usernames` path in `list-users`, that indicates that the fields are take from the response. It is also possible to use the `args` root field to take the values from the arguments. For example, the following example uses both arguments and response to built the variable value: 253 | 254 | ```yaml 255 | list-role-policies: 256 | ... # stripped 257 | outvars: 258 | iam-role-policies: "{role: args.RoleName, policies: response.PolicyNames}" 259 | ``` 260 | 261 | 262 | There is a couple more of keywords (at this moment). The first one is `scope`, that can be private or public. The scope `public` means that the operation returns information that is not specific for the target account, but for any user in AWS, and many of them retrieve a lot of information. Therefore, by default they are not considered relevant and not used, but you can allow them with the `--allow-public` flag if you want. Some public operations are `ec2 describe-host-reservation-offerings` or `route53 get-checker-ip-ranges`. 263 | 264 | 265 | The another keyword is `allowed_client_error` that specifies an error that is considered a valid operation call. For example in `get-bucket-website` an error is retrieved if the bucket is not used to host a website, and returns a not found error, but we consider this a valid call, since is not denied (if you have permissions). So this is how is it specified: 266 | 267 | ```yaml 268 | get-bucket-website: 269 | allowed_client_error: NoSuchWebsiteConfiguration 270 | .. # stripped 271 | ``` 272 | 273 | This is the explanation about the meta API file, that, unfortunately, is still far from being complete. 274 | -------------------------------------------------------------------------------- /awsenum/apidef/api-meta.yml: -------------------------------------------------------------------------------- 1 | accessanalyzer: {} 2 | 3 | account: {} 4 | 5 | acm: {} 6 | 7 | acm-pca: {} 8 | 9 | alexaforbusiness: {} 10 | 11 | amplify: {} 12 | 13 | amplifybackend: 14 | 15 | list-s3-buckets: 16 | outvars: 17 | s3-buckets-names: "response.Buckets[].Name" 18 | 19 | amplifyuibuilder: {} 20 | 21 | apigateway: 22 | 23 | get-sdk-types: 24 | versions: 25 | - scope: public 26 | 27 | apigatewaymanagementapi: {} 28 | 29 | apigatewayv2: {} 30 | 31 | appconfig: {} 32 | 33 | appconfigdata: {} 34 | 35 | appflow: {} 36 | 37 | appintegrations: {} 38 | 39 | application-autoscaling: {} 40 | 41 | application-insights: {} 42 | 43 | applicationcostprofiler: {} 44 | 45 | appmesh: {} 46 | 47 | apprunner: {} 48 | 49 | appstream: 50 | 51 | describe-images: 52 | versions: 53 | - args: 54 | Type: 55 | value: PRIVATE 56 | - args: 57 | Type: 58 | value: SHARED 59 | 60 | appsync: {} 61 | 62 | athena: {} 63 | 64 | auditmanager: {} 65 | 66 | autoscaling: {} 67 | 68 | autoscaling-plans: {} 69 | 70 | backup: {} 71 | 72 | backup-gateway: {} 73 | 74 | batch: {} 75 | 76 | billingconductor: {} 77 | 78 | braket: {} 79 | 80 | budgets: {} 81 | 82 | ce: {} 83 | 84 | chime: {} 85 | 86 | chime-sdk-identity: {} 87 | 88 | chime-sdk-media-pipelines: {} 89 | 90 | chime-sdk-meetings: {} 91 | 92 | chime-sdk-messaging: {} 93 | 94 | cloud9: {} 95 | 96 | cloudcontrol: {} 97 | 98 | clouddirectory: {} 99 | 100 | cloudformation: {} 101 | 102 | cloudfront: {} 103 | 104 | cloudhsm: {} 105 | 106 | cloudhsmv2: {} 107 | 108 | cloudsearch: {} 109 | 110 | cloudsearchdomain: {} 111 | 112 | cloudtrail: {} 113 | 114 | cloudwatch: {} 115 | 116 | codeartifact: {} 117 | 118 | codebuild: 119 | 120 | list-curated-environment-images: 121 | versions: 122 | - scope: public 123 | 124 | codecommit: {} 125 | 126 | codedeploy: {} 127 | 128 | codeguru-reviewer: {} 129 | 130 | codeguruprofiler: {} 131 | 132 | codepipeline: 133 | 134 | list-action-types: 135 | versions: 136 | - args: 137 | actionOwnerFilter: 138 | value: Custom 139 | 140 | codestar: {} 141 | 142 | codestar-connections: {} 143 | 144 | codestar-notifications: 145 | 146 | list-event-types: 147 | versions: 148 | - scope: public 149 | 150 | cognito-identity: {} 151 | 152 | cognito-idp: {} 153 | 154 | cognito-sync: {} 155 | 156 | comprehend: {} 157 | 158 | comprehendmedical: {} 159 | 160 | compute-optimizer: {} 161 | 162 | config: {} 163 | 164 | connect: {} 165 | 166 | connect-contact-lens: {} 167 | 168 | connectparticipant: {} 169 | 170 | cur: {} 171 | 172 | customer-profiles: {} 173 | 174 | databrew: {} 175 | 176 | dataexchange: {} 177 | 178 | datapipeline: {} 179 | 180 | datasync: {} 181 | 182 | dax: {} 183 | 184 | detective: {} 185 | 186 | devicefarm: {} 187 | 188 | devops-guru: {} 189 | 190 | directconnect: 191 | 192 | describe-locations: 193 | versions: 194 | - scope: public 195 | 196 | discovery: {} 197 | 198 | dlm: {} 199 | 200 | dms: 201 | 202 | describe-endpoint-types: 203 | versions: 204 | - scope: public 205 | 206 | describe-event-categories: 207 | versions: 208 | - scope: public 209 | 210 | describe-orderable-replication-instances: 211 | versions: 212 | - scope: public 213 | 214 | docdb: 215 | 216 | describe-db-engine-versions: 217 | versions: 218 | - scope: public 219 | 220 | describe-event-categories: 221 | versions: 222 | - scope: public 223 | 224 | drs: {} 225 | 226 | ds: {} 227 | 228 | dynamodb: {} 229 | 230 | dynamodbstreams: {} 231 | 232 | ebs: {} 233 | 234 | ec2: 235 | 236 | describe-account-attributes: {} 237 | 238 | describe-aggregate-id-format: 239 | versions: 240 | - scope: public 241 | 242 | describe-availability-zones: 243 | versions: 244 | - scope: public 245 | 246 | describe-fpga-images: 247 | versions: 248 | - args: 249 | Owners: 250 | value: [self] 251 | 252 | describe-host-reservation-offerings: 253 | versions: 254 | - scope: public 255 | 256 | describe-id-format: 257 | versions: 258 | - scope: public 259 | 260 | describe-images: 261 | versions: 262 | - args: 263 | OwnerIds: 264 | value: [self] 265 | 266 | describe-instance-type-offerings: 267 | versions: 268 | - scope: public 269 | 270 | describe-instance-types: 271 | versions: 272 | - scope: public 273 | 274 | describe-instances: 275 | outvars: 276 | ec2-instances-ids: "response.Reservations[].Instances[].InstanceId" 277 | 278 | describe-key-pairs: {} 279 | 280 | describe-principal-id-format: 281 | versions: 282 | - scope: public 283 | 284 | describe-regions: 285 | versions: 286 | - scope: public 287 | 288 | describe-reserved-instances-offerings: 289 | versions: 290 | - scope: public 291 | 292 | describe-snapshots: 293 | versions: 294 | - args: 295 | OwnerIds: 296 | value: [self] 297 | 298 | describe-spot-price-history: 299 | versions: 300 | - scope: public 301 | 302 | describe-subnets: {} 303 | 304 | describe-vpc-endpoint-services: 305 | versions: 306 | - scope: public 307 | 308 | describe-vpcs: {} 309 | 310 | get-password-data: 311 | versions: 312 | - invar: ec2-instances-ids 313 | args: 314 | InstanceId: 315 | invar_path: "" 316 | mode: "foreach" 317 | 318 | get-vpn-connection-device-types: 319 | versions: 320 | - scope: public 321 | 322 | ec2-instance-connect: {} 323 | 324 | ecr: {} 325 | 326 | ecr-public: {} 327 | 328 | ecs: 329 | 330 | describe-capacity-providers: 331 | versions: 332 | - scope: public 333 | 334 | describe-tasks: 335 | versions: 336 | - invar: 337 | name: ecs-cluster-tasks 338 | mode: single 339 | args: 340 | cluster: 341 | invar_path: "cluster" 342 | mode: single 343 | tasks: 344 | invar_path: "tasks" 345 | mode: single 346 | 347 | describe-services: 348 | versions: 349 | - invar: 350 | name: ecs-cluster-services 351 | mode: single 352 | args: 353 | cluster: 354 | invar_path: "cluster" 355 | mode: single 356 | services: 357 | invar_path: "services" 358 | mode: single 359 | 360 | list-clusters: 361 | outvars: 362 | ecs-clusters-arns: "response.clusterArns" 363 | 364 | list-services: 365 | versions: 366 | - invar: ecs-clusters-arns 367 | args: 368 | cluster: 369 | invar_path: "" 370 | mode: foreach 371 | 372 | outvars: 373 | ecs-cluster-services: "{cluster: args.cluster, services: response.serviceArns}" 374 | 375 | 376 | list-tasks: 377 | versions: 378 | - invar: ecs-clusters-arns 379 | args: 380 | cluster: 381 | invar_path: "" 382 | mode: foreach 383 | 384 | outvars: 385 | ecs-cluster-tasks: "{cluster: args.cluster, tasks: response.taskArns}" 386 | 387 | 388 | efs: {} 389 | 390 | eks: 391 | 392 | describe-addon-versions: 393 | versions: 394 | - scope: public 395 | 396 | elastic-inference: 397 | 398 | describe-accelerator-types: 399 | versions: 400 | - scope: public 401 | 402 | elasticache: 403 | 404 | describe-cache-engine-versions: 405 | versions: 406 | - scope: public 407 | 408 | describe-service-updates: 409 | versions: 410 | - scope: public 411 | 412 | describe-reserved-cache-nodes-offerings: 413 | versions: 414 | - scope: public 415 | 416 | elasticbeanstalk: 417 | 418 | list-available-solution-stacks: 419 | versions: 420 | - scope: public 421 | 422 | list-platform-branches: 423 | versions: 424 | - scope: public 425 | 426 | list-platform-versions: 427 | versions: 428 | - scope: public 429 | 430 | elastictranscoder: 431 | 432 | list-presets: 433 | versions: 434 | - scope: public 435 | 436 | elb: 437 | 438 | describe-load-balancer-policy-types: 439 | versions: 440 | - scope: public 441 | 442 | elbv2: {} 443 | 444 | emr: 445 | 446 | list-release-labels: 447 | versions: 448 | - scope: public 449 | 450 | emr-containers: {} 451 | 452 | es: 453 | 454 | describe-reserved-elasticsearch-instance-offerings: 455 | versions: 456 | - scope: public 457 | 458 | get-compatible-elasticsearch-versions: 459 | versions: 460 | - scope: public 461 | 462 | list-elasticsearch-versions: 463 | versions: 464 | - scope: public 465 | 466 | events: {} 467 | 468 | evidently: {} 469 | 470 | finspace: {} 471 | 472 | finspace-data: {} 473 | 474 | firehose: {} 475 | 476 | fis: 477 | 478 | list-actions: 479 | versions: 480 | - scope: public 481 | 482 | list-target-resource-types: 483 | versions: 484 | - scope: public 485 | 486 | fms: {} 487 | 488 | forecast: {} 489 | 490 | forecastquery: {} 491 | 492 | frauddetector: {} 493 | 494 | fsx: {} 495 | 496 | gamelift: {} 497 | 498 | gamesparks: {} 499 | 500 | glacier: {} 501 | 502 | globalaccelerator: {} 503 | 504 | glue: {} 505 | 506 | grafana: {} 507 | 508 | greengrass: {} 509 | 510 | greengrassv2: {} 511 | 512 | groundstation: {} 513 | 514 | guardduty: {} 515 | 516 | health: {} 517 | 518 | healthlake: {} 519 | 520 | honeycode: {} 521 | 522 | iam: 523 | 524 | get-policy: 525 | versions: 526 | - invar: iam-policies-arns 527 | args: 528 | PolicyArn: 529 | mode: "foreach" 530 | # avoid query for aws managed policies 531 | invar_path: '[?!starts_with(@, `arn:aws:iam::aws:`)]' 532 | 533 | outvars: 534 | iam-policy-versions: "response.Policy.{policy: Arn, versions: [DefaultVersionId]}" 535 | 536 | get-policy-version: 537 | versions: 538 | - invar: iam-policy-versions 539 | args: 540 | PolicyArn: 541 | invar_path: "policy" 542 | mode: "single" 543 | 544 | VersionId: 545 | invar_path: "versions" 546 | mode: "foreach" 547 | 548 | - invar: 549 | name: iam-policies-versions 550 | mode: foreach 551 | args: 552 | PolicyArn: 553 | invar_path: "policy" 554 | mode: single 555 | 556 | VersionId: 557 | invar_path: "versions" 558 | mode: foreach 559 | 560 | get-role: 561 | versions: 562 | - invar: iam-rolenames 563 | args: 564 | RoleName: 565 | invar_path: "" 566 | mode: foreach 567 | 568 | get-role-policy: 569 | versions: 570 | - invar: iam-role-policies 571 | 572 | args: 573 | RoleName: 574 | invar_path: "role" 575 | mode: "single" 576 | PolicyName: 577 | invar_path: "policies" 578 | mode: "foreach" 579 | 580 | get-user-policy: 581 | versions: 582 | - invar: iam-user-attached-policies 583 | 584 | args: 585 | UserName: 586 | invar_path: "user" 587 | mode: "single" 588 | PolicyName: 589 | invar_path: "policies" 590 | mode: "foreach" 591 | 592 | list-attached-role-policies: 593 | versions: 594 | - invar: iam-rolenames 595 | args: 596 | RoleName: 597 | invar_path: "" 598 | mode: foreach 599 | 600 | outvars: 601 | iam-policies-arns: "response.AttachedPolicies[].PolicyArn" 602 | 603 | list-attached-user-policies: 604 | versions: 605 | - invar: iam-usernames 606 | 607 | args: 608 | UserName: 609 | invar_path: "" 610 | mode: "foreach" 611 | 612 | outvars: 613 | iam-policies-arns: "response.AttachedPolicies[].PolicyArn" 614 | 615 | list-policies: 616 | versions: 617 | - args: 618 | Scope: 619 | value: Local 620 | 621 | outvars: 622 | iam-policies-arns: "response.Policies[].Arn" 623 | iam-policies-versions: "response.Policies[].{policy: Arn, versions: [DefaultVersionId]}" 624 | 625 | list-policy-versions: 626 | versions: 627 | - invar: iam-policies-arns 628 | args: 629 | PolicyArn: 630 | mode: "foreach" 631 | # avoid query for aws managed policies 632 | invar_path: '[?!starts_with(@, `arn:aws:iam::aws:`)]' 633 | 634 | outvars: 635 | iam-policy-versions: "{policy: args.PolicyArn, versions: response.Versions[].VersionId}" 636 | 637 | list-role-policies: 638 | versions: 639 | - invar: iam-rolenames 640 | args: 641 | RoleName: 642 | invar_path: "" 643 | mode: foreach 644 | 645 | outvars: 646 | iam-role-policies: "{role: args.RoleName, policies: response.PolicyNames}" 647 | 648 | list-user-policies: 649 | versions: 650 | - invar: iam-usernames 651 | args: 652 | UserName: 653 | invar_path: "" 654 | mode: "foreach" 655 | 656 | outvars: 657 | iam-user-attached-policies: "{user: args.UserName, policies: response.PolicyNames}" 658 | 659 | list-roles: 660 | outvars: 661 | iam-rolenames: "response.Roles[].RoleName" 662 | 663 | list-users: 664 | outvars: 665 | iam-usernames: "response.Users[].UserName" 666 | 667 | get-user: 668 | versions: 669 | - {} 670 | - invar: iam-usernames 671 | args: 672 | UserName: 673 | invar_path: "" 674 | mode: foreach 675 | 676 | identitystore: {} 677 | 678 | imagebuilder: {} 679 | 680 | importexport: {} 681 | 682 | inspector: {} 683 | 684 | inspector2: {} 685 | 686 | iot: 687 | 688 | list-managed-job-templates: 689 | versions: 690 | - scope: public 691 | 692 | iot-data: {} 693 | 694 | iot-jobs-data: {} 695 | 696 | iot1click-devices: {} 697 | 698 | iot1click-projects: {} 699 | 700 | iotanalytics: {} 701 | 702 | iotdeviceadvisor: {} 703 | 704 | iotevents: {} 705 | 706 | iotevents-data: {} 707 | 708 | iotfleethub: {} 709 | 710 | iotsecuretunneling: {} 711 | 712 | iotsitewise: {} 713 | 714 | iotthingsgraph: {} 715 | 716 | iottwinmaker: {} 717 | 718 | iotwireless: {} 719 | 720 | ivs: {} 721 | 722 | ivschat: {} 723 | 724 | kafka: 725 | 726 | get-compatible-kafka-versions: 727 | versions: 728 | - scope: public 729 | 730 | list-kafka-versions: 731 | versions: 732 | - scope: public 733 | 734 | kafkaconnect: {} 735 | 736 | kendra: {} 737 | 738 | keyspaces: {} 739 | 740 | kinesis: {} 741 | 742 | kinesis-video-archived-media: {} 743 | 744 | kinesis-video-media: {} 745 | 746 | kinesis-video-signaling: {} 747 | 748 | kinesisanalytics: {} 749 | 750 | kinesisanalyticsv2: {} 751 | 752 | kinesisvideo: {} 753 | 754 | kms: {} 755 | 756 | lakeformation: {} 757 | 758 | lambda: 759 | 760 | get-function: 761 | versions: 762 | - invar: lambda-functions-names 763 | args: 764 | FunctionName: 765 | invar_path: "" 766 | mode: "foreach" 767 | 768 | 769 | list-functions: 770 | outvars: 771 | lambda-functions-names: "response.Functions[].FunctionName" 772 | 773 | lex-models: 774 | get-builtin-intents: 775 | versions: 776 | - scope: public 777 | 778 | get-builtin-slot-types: 779 | versions: 780 | - scope: public 781 | 782 | lex-runtime: {} 783 | 784 | lexv2-models: {} 785 | 786 | lexv2-runtime: {} 787 | 788 | license-manager: {} 789 | 790 | lightsail: 791 | 792 | get-blueprints: 793 | versions: 794 | - scope: public 795 | 796 | get-bucket-bundles: 797 | versions: 798 | - scope: public 799 | 800 | get-bundles: 801 | versions: 802 | - scope: public 803 | 804 | get-container-service-powers: 805 | versions: 806 | - scope: public 807 | 808 | get-regions: 809 | versions: 810 | - scope: public 811 | 812 | get-relational-database-blueprints: 813 | versions: 814 | - scope: public 815 | 816 | get-relational-database-bundles: 817 | versions: 818 | - scope: public 819 | 820 | location: {} 821 | 822 | logs: {} 823 | 824 | lookoutequipment: {} 825 | 826 | lookoutmetrics: {} 827 | 828 | lookoutvision: {} 829 | 830 | machinelearning: {} 831 | 832 | macie: {} 833 | 834 | macie2: {} 835 | 836 | managedblockchain: {} 837 | 838 | marketplace-catalog: {} 839 | 840 | marketplace-entitlement: {} 841 | 842 | marketplacecommerceanalytics: {} 843 | 844 | mediaconnect: {} 845 | 846 | mediaconvert: {} 847 | 848 | medialive: 849 | list-offerings: 850 | versions: 851 | - scope: public 852 | 853 | mediapackage: {} 854 | 855 | mediapackage-vod: {} 856 | 857 | mediastore: {} 858 | 859 | mediastore-data: {} 860 | 861 | mediatailor: {} 862 | 863 | memorydb: {} 864 | 865 | meteringmarketplace: {} 866 | 867 | mgh: {} 868 | 869 | mgn: {} 870 | 871 | migration-hub-refactor-spaces: {} 872 | 873 | migrationhub-config: {} 874 | 875 | migrationhubstrategy: {} 876 | 877 | mobile: {} 878 | 879 | mq: 880 | 881 | describe-broker-engine-types: 882 | versions: 883 | - scope: public 884 | 885 | describe-broker-instance-options: 886 | versions: 887 | - scope: public 888 | 889 | mturk: {} 890 | 891 | mwaa: {} 892 | 893 | neptune: 894 | 895 | describe-db-engine-versions: 896 | versions: 897 | - scope: public 898 | 899 | describe-event-categories: 900 | versions: 901 | - scope: public 902 | 903 | network-firewall: {} 904 | 905 | networkmanager: {} 906 | 907 | nimble: {} 908 | 909 | opensearch: 910 | 911 | describe-reserved-instance-offerings: 912 | versions: 913 | - scope: public 914 | 915 | get-compatible-versions: 916 | versions: 917 | - scope: public 918 | 919 | list-versions: 920 | versions: 921 | - scope: public 922 | 923 | opsworks: 924 | 925 | describe-operating-systems: 926 | versions: 927 | - scope: public 928 | 929 | opsworkscm: {} 930 | 931 | organizations: {} 932 | 933 | outposts: 934 | 935 | list-catalog-items: 936 | versions: 937 | - scope: public 938 | 939 | panorama: {} 940 | 941 | personalize: {} 942 | 943 | personalize-events: {} 944 | 945 | personalize-runtime: {} 946 | 947 | pi: {} 948 | 949 | pinpoint: {} 950 | 951 | pinpoint-email: {} 952 | 953 | pinpoint-sms-voice: {} 954 | 955 | pinpoint-sms-voice-v2: {} 956 | 957 | polly: 958 | 959 | describe-voices: 960 | versions: 961 | - scope: public 962 | 963 | pricing: {} 964 | 965 | proton: {} 966 | 967 | qldb: {} 968 | 969 | qldb-session: {} 970 | 971 | quicksight: {} 972 | 973 | ram: 974 | list-resource-types: 975 | versions: 976 | - scope: public 977 | 978 | rbin: {} 979 | 980 | rds: 981 | 982 | describe-db-engine-versions: 983 | versions: 984 | - scope: public 985 | 986 | describe-event-categories: 987 | versions: 988 | - scope: public 989 | 990 | describe-reserved-db-instances-offerings: 991 | versions: 992 | - scope: public 993 | 994 | describe-source-regions: 995 | versions: 996 | - scope: public 997 | 998 | rds-data: {} 999 | 1000 | redshift: 1001 | 1002 | describe-cluster-tracks: 1003 | versions: 1004 | - scope: public 1005 | 1006 | describe-event-categories: 1007 | versions: 1008 | - scope: public 1009 | 1010 | describe-orderable-cluster-options: 1011 | versions: 1012 | - scope: public 1013 | 1014 | describe-reserved-node-offerings: 1015 | versions: 1016 | - scope: public 1017 | 1018 | redshift-data: {} 1019 | 1020 | rekognition: {} 1021 | 1022 | resiliencehub: 1023 | 1024 | list-suggested-resiliency-policies: 1025 | versions: 1026 | - scope: public 1027 | 1028 | resource-groups: {} 1029 | 1030 | resourcegroupstaggingapi: {} 1031 | 1032 | robomaker: {} 1033 | 1034 | route53: 1035 | 1036 | get-checker-ip-ranges: 1037 | versions: 1038 | - scope: public 1039 | 1040 | list-geo-locations: 1041 | versions: 1042 | - scope: public 1043 | 1044 | route53-recovery-cluster: {} 1045 | 1046 | route53-recovery-control-config: {} 1047 | 1048 | route53-recovery-readiness: {} 1049 | 1050 | route53domains: {} 1051 | 1052 | route53resolver: {} 1053 | 1054 | rum: {} 1055 | 1056 | s3: 1057 | 1058 | get-bucket-accelerate-configuration: 1059 | versions: 1060 | - invar: s3-buckets-names 1061 | args: 1062 | Bucket: 1063 | invar_path: "" 1064 | mode: "foreach" 1065 | 1066 | get-bucket-acl: 1067 | versions: 1068 | - invar: s3-buckets-names 1069 | args: 1070 | Bucket: 1071 | invar_path: "" 1072 | mode: "foreach" 1073 | 1074 | # returns client error if cors configuration is not found 1075 | get-bucket-cors: 1076 | allowed_client_error: NoSuchCORSConfiguration 1077 | versions: 1078 | - invar: s3-buckets-names 1079 | args: 1080 | Bucket: 1081 | invar_path: "" 1082 | mode: "foreach" 1083 | 1084 | # returns client error if encryption configuration isn't found 1085 | get-bucket-encryption: 1086 | allowed_client_error: ServerSideEncryptionConfigurationNotFoundError 1087 | versions: 1088 | - invar: s3-buckets-names 1089 | args: 1090 | Bucket: 1091 | invar_path: "" 1092 | mode: "foreach" 1093 | 1094 | get-bucket-logging: 1095 | versions: 1096 | - invar: s3-buckets-names 1097 | args: 1098 | Bucket: 1099 | invar_path: "" 1100 | mode: "foreach" 1101 | 1102 | get-bucket-ownership-controls: 1103 | versions: 1104 | - invar: s3-buckets-names 1105 | args: 1106 | Bucket: 1107 | invar_path: "" 1108 | mode: "foreach" 1109 | 1110 | 1111 | # returns client error if the bucket policy doesn't exist 1112 | get-bucket-policy: 1113 | allowed_client_error: NoSuchBucketPolicy 1114 | versions: 1115 | - invar: s3-buckets-names 1116 | args: 1117 | Bucket: 1118 | invar_path: "" 1119 | mode: "foreach" 1120 | 1121 | # returns client error if the bucket policy doesn't exist 1122 | get-bucket-policy-status: 1123 | allowed_client_error: NoSuchBucketPolicy 1124 | versions: 1125 | - invar: s3-buckets-names 1126 | args: 1127 | Bucket: 1128 | invar_path: "" 1129 | mode: "foreach" 1130 | 1131 | # returns client error if website configuration isn't found 1132 | get-bucket-website: 1133 | allowed_client_error: NoSuchWebsiteConfiguration 1134 | versions: 1135 | - invar: s3-buckets-names 1136 | args: 1137 | Bucket: 1138 | invar_path: "" 1139 | mode: "foreach" 1140 | 1141 | list-buckets: 1142 | outvars: 1143 | s3-buckets-names: "response.Buckets[].Name" 1144 | 1145 | list-objects: 1146 | versions: 1147 | - invar: s3-buckets-names 1148 | args: 1149 | Bucket: 1150 | invar_path: "" 1151 | mode: "foreach" 1152 | 1153 | list-objects-v2: 1154 | versions: 1155 | - invar: s3-buckets-names 1156 | args: 1157 | Bucket: 1158 | invar_path: "" 1159 | mode: "foreach" 1160 | 1161 | list-object-versions: 1162 | versions: 1163 | - invar: s3-buckets-names 1164 | args: 1165 | Bucket: 1166 | invar_path: "" 1167 | mode: "foreach" 1168 | 1169 | s3control: {} 1170 | 1171 | s3outposts: {} 1172 | 1173 | sagemaker: 1174 | 1175 | list-model-metadata: 1176 | versions: 1177 | - scope: public 1178 | 1179 | sagemaker-a2i-runtime: {} 1180 | 1181 | sagemaker-edge: {} 1182 | 1183 | sagemaker-featurestore-runtime: {} 1184 | 1185 | sagemaker-runtime: {} 1186 | 1187 | savingsplans: 1188 | 1189 | describe-savings-plans-offering-rates: 1190 | versions: 1191 | - scope: public 1192 | 1193 | describe-savings-plans-offerings: 1194 | versions: 1195 | - scope: public 1196 | 1197 | schemas: {} 1198 | 1199 | sdb: {} 1200 | 1201 | secretsmanager: 1202 | 1203 | get-secret-value: 1204 | versions: 1205 | - invar: secretsmanager-secrets-arns 1206 | args: 1207 | SecretId: 1208 | invar_path: "" 1209 | mode: foreach 1210 | 1211 | list-secrets: 1212 | outvars: 1213 | secretsmanager-secrets-arns: "response.SecretList[].ARN" 1214 | 1215 | securityhub: 1216 | 1217 | describe-standards: 1218 | versions: 1219 | - scope: public 1220 | 1221 | serverlessrepo: {} 1222 | 1223 | service-quotas: {} 1224 | 1225 | servicecatalog: {} 1226 | 1227 | servicecatalog-appregistry: {} 1228 | 1229 | servicediscovery: {} 1230 | 1231 | ses: {} 1232 | 1233 | sesv2: {} 1234 | 1235 | shield: {} 1236 | 1237 | signer: 1238 | 1239 | list-signing-platforms: 1240 | versions: 1241 | - scope: public 1242 | 1243 | sms: {} 1244 | 1245 | snow-device-management: {} 1246 | 1247 | snowball: {} 1248 | 1249 | sns: {} 1250 | 1251 | sqs: {} 1252 | 1253 | ssm: 1254 | 1255 | describe-available-patches: 1256 | versions: 1257 | - scope: public 1258 | 1259 | describe-patch-baselines: 1260 | versions: 1261 | - scope: public 1262 | - args: 1263 | Filters: 1264 | value: [{Key: OWNER, Values: [Self]}] 1265 | 1266 | get-inventory-schema: 1267 | versions: 1268 | - scope: public 1269 | 1270 | list-documents: 1271 | versions: 1272 | - scope: public 1273 | - args: 1274 | Filters: 1275 | value: [{Key: Owner, Values: [Self]}] 1276 | 1277 | ssm-contacts: {} 1278 | 1279 | ssm-incidents: {} 1280 | 1281 | sso: {} 1282 | 1283 | sso-admin: {} 1284 | 1285 | sso-oidc: {} 1286 | 1287 | stepfunctions: {} 1288 | 1289 | storagegateway: {} 1290 | 1291 | sts: {} 1292 | 1293 | support: {} 1294 | 1295 | swf: 1296 | 1297 | list-domains: 1298 | versions: 1299 | - args: 1300 | registrationStatus: 1301 | value: REGISTERED 1302 | 1303 | - args: 1304 | registrationStatus: 1305 | value: DEPRECATED 1306 | 1307 | synthetics: 1308 | 1309 | describe-runtime-versions: 1310 | versions: 1311 | - scope: public 1312 | 1313 | textract: {} 1314 | 1315 | timestream-query: {} 1316 | 1317 | timestream-write: {} 1318 | 1319 | transcribe: {} 1320 | 1321 | transfer: {} 1322 | 1323 | translate: {} 1324 | 1325 | voice-id: {} 1326 | 1327 | waf: {} 1328 | 1329 | waf-regional: {} 1330 | 1331 | wafv2: {} 1332 | 1333 | wellarchitected: {} 1334 | 1335 | wisdom: {} 1336 | 1337 | workdocs: {} 1338 | 1339 | worklink: {} 1340 | 1341 | workmail: {} 1342 | 1343 | workmailmessageflow: {} 1344 | 1345 | workspaces: {} 1346 | 1347 | workspaces-web: {} 1348 | 1349 | xray: {} 1350 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | awsenum 633 | Copyright (C) 2022 Zer1t0 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------