mostly fixes to handle a root key that has perms but shit isnt actually set up

This commit is contained in:
carnal0wnage
2018-04-11 22:50:24 -04:00
parent c6802744f1
commit 89e758a4cf
27 changed files with 543 additions and 32 deletions

View File

@@ -9,22 +9,29 @@ regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', '
def describe_db_instances(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
print("doing stuff")
try:
for region in regions:
client = boto3.client(
'rds',
aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SECRET_ACCESS_KEY,
region_name=region
)
print("doing stuff")
try:
for region in regions:
client = boto3.client(
'rds',
aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SECRET_ACCESS_KEY,
region_name=region
)
instances = client.describe_db_instances()
for r in instances['DBInstances']:
for i in r['Instances']:
pp.pprint(i)
instances = client.describe_db_instances()
for r in instances['DBInstances']:
for i in r['Instances']:
pp.pprint(i)
except botocore.exceptions.ClientError as e:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == 'InvalidClientTokenId':
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
elif e.response['Error']['Code'] == 'AccessDenied':
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
else:
print("Unexpected error: {}" .format(e))
except KeyboardInterrupt:
print("CTRL-C received, exiting...")