I have decided to temporarily just fix all the print statements since it did not take long with some atom/regex fu
This commit is contained in:
@@ -21,9 +21,9 @@ def list_pipelines(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
response = client.list_pipelines()
|
||||
print"### {} Data Pipelines ###" .format(region)
|
||||
if response.get('pipelineIdList') is None:
|
||||
print "{} likely does not have Data Pipeline permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have Data Pipeline permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['pipelineIdList']) <= 0:
|
||||
print "[-] ListPipelines allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListPipelines allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} Data Pipelines ###" .format(region)
|
||||
for pipes in response['pipelineIdList']:
|
||||
@@ -36,6 +36,6 @@ def list_pipelines(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -20,9 +20,9 @@ def list_dynamodb_tables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
|
||||
response = client.list_tables()
|
||||
if response.get('TableNames') is None:
|
||||
print "{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['TableNames']) <= 0:
|
||||
print "[-] ListTables allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListTables allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} DynamoDB Tables ###" .format(region)
|
||||
for tables in response['TableNames']:
|
||||
@@ -35,7 +35,7 @@ def list_dynamodb_tables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -47,9 +47,9 @@ def list_dynamodb_tables_detailed(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
|
||||
response = client.list_tables()
|
||||
if response.get('TableNames') is None:
|
||||
print "{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['TableNames']) <= 0:
|
||||
print "[-] ListTables allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListTables allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} DynamoDB Tables ###" .format(region)
|
||||
for tables in response['TableNames']:
|
||||
@@ -63,30 +63,30 @@ def list_dynamodb_tables_detailed(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
def describe_table(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, table, region):
|
||||
print "### Describing DynamoDB Table: {} ###" .format(table)
|
||||
print("### Describing DynamoDB Table: {} ###" .format(table))
|
||||
try:
|
||||
client = boto3.client('dynamodb', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY, region_name=region)
|
||||
|
||||
response = client.describe_table(TableName=table)
|
||||
if response.get('Table') is None:
|
||||
print "{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Table']) <= 0:
|
||||
print "[-] DescribeTable allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeTable allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print "TableArn: {}" .format(response['Table']['TableArn'])
|
||||
print "AttributeDefinitions: {}" .format(response['Table']['AttributeDefinitions'])
|
||||
print "ProvisionedThroughput: {}" .format(response['Table']['ProvisionedThroughput'])
|
||||
print "TableSizeBytes: {}" .format(response['Table']['TableSizeBytes'])
|
||||
print "TableName: {}" .format(response['Table']['TableName'])
|
||||
print "TableStatus: {}" .format(response['Table']['TableStatus'])
|
||||
print "KeySchema: {}" .format(response['Table']['KeySchema'])
|
||||
print "ItemCount: {}" .format(response['Table']['ItemCount'])
|
||||
print "CreationDateTime: {}" .format(response['Table']['CreationDateTime'])
|
||||
print("TableArn: {}" .format(response['Table']['TableArn']))
|
||||
print("AttributeDefinitions: {}" .format(response['Table']['AttributeDefinitions']))
|
||||
print("ProvisionedThroughput: {}" .format(response['Table']['ProvisionedThroughput']))
|
||||
print("TableSizeBytes: {}" .format(response['Table']['TableSizeBytes']))
|
||||
print("TableName: {}" .format(response['Table']['TableName']))
|
||||
print("TableStatus: {}" .format(response['Table']['TableStatus']))
|
||||
print("KeySchema: {}" .format(response['Table']['KeySchema']))
|
||||
print("ItemCount: {}" .format(response['Table']['ItemCount']))
|
||||
print("CreationDateTime: {}" .format(response['Table']['CreationDateTime']))
|
||||
print("\n")
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
@@ -95,7 +95,6 @@ def describe_table(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, table, region):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ def list_dynamodbstreams(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
|
||||
response = client.list_streams()
|
||||
if response.get('Streams') is None:
|
||||
print "{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have DynamoDB permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Streams']) <= 0:
|
||||
print "[-] ListStreams allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListStreams allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} DynamoDB Streams ###" .format(region)
|
||||
for streams in response['Streams']:
|
||||
@@ -36,6 +36,6 @@ def list_dynamodbstreams(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
@@ -23,9 +23,9 @@ def describe_repositories(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('repositories') is None:
|
||||
print "{} likely does not have ECR permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ECR permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['repositories']) <= 0:
|
||||
print "[-] DescribeRepositories allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeRepositories allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ECR Repositories ###" .format(region)
|
||||
for tables in response['repositories']:
|
||||
@@ -38,6 +38,6 @@ def describe_repositories(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -23,9 +23,9 @@ def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('Applications') is None:
|
||||
print "{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Applications']) <= 0:
|
||||
print "[-] DescribeApplications allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeApplications allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ElasticBeanstalk Applications ###" .format(region)
|
||||
for app in response['Applications']:
|
||||
@@ -38,7 +38,7 @@ def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -53,9 +53,9 @@ def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('ApplicationVersions') is None:
|
||||
print "{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['ApplicationVersions']) <= 0:
|
||||
print "[-] DescribeApplicationVersions allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeApplicationVersions allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ElasticBeanstalk Application Versions ###" .format(region)
|
||||
for app in response['ApplicationVersions']:
|
||||
@@ -68,7 +68,7 @@ def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -83,17 +83,17 @@ def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('Options') is None:
|
||||
print "{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Options']) <= 0:
|
||||
print "[-] DescribeConfigurationOptions allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeConfigurationOptions allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ElasticBeanstalk Configuration Options ###" .format(region)
|
||||
#if response['PlatformArn'] is None:
|
||||
# pass
|
||||
#else:
|
||||
# print "PlatformArn: {}" .format(response['PlatformArn'])
|
||||
# print("PlatformArn: {}" .format(response['PlatformArn']))
|
||||
|
||||
print "SolutionStackName: {}" .format(response['SolutionStackName'])
|
||||
print("SolutionStackName: {}" .format(response['SolutionStackName']))
|
||||
pp.pprint( "Options: {}" .format(response['Options']))
|
||||
print("\n")
|
||||
|
||||
@@ -103,7 +103,7 @@ def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -118,9 +118,9 @@ def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('Environments') is None:
|
||||
print "{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Environments']) <= 0:
|
||||
print "[-] DescribeEnvironments allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeEnvironments allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ElasticBeanstalk Environments ###" .format(region)
|
||||
for enviro in response['Environments']:
|
||||
@@ -133,7 +133,7 @@ def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -148,9 +148,9 @@ def describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('Events') is None:
|
||||
print "{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Events']) <= 0:
|
||||
print "[-] DescribeEvents allowed for {} but no results [-]" .format(region)
|
||||
print("[-] DescribeEvents allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} ElasticBeanstalk Events ###" .format(region)
|
||||
for events in response['Events']:
|
||||
@@ -163,7 +163,7 @@ def describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
|
||||
12
libs/emr.py
12
libs/emr.py
@@ -23,9 +23,9 @@ def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('Clusters') is None:
|
||||
print "{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Clusters']) <= 0:
|
||||
print "[-] ListClusters allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListClusters allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} EMR Clusters ###" .format(region)
|
||||
for app in response['Clusters']:
|
||||
@@ -38,7 +38,7 @@ def list_clusters(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -53,9 +53,9 @@ def list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('SecurityConfigurations') is None:
|
||||
print "{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['SecurityConfigurations']) <= 0:
|
||||
print "[-] ListSecurityConfigurations allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListSecurityConfigurations allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} EMR Security Configuration ###" .format(region)
|
||||
for app in response['SecurityConfigurations']:
|
||||
@@ -68,7 +68,7 @@ def list_security_configurations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
|
||||
22
libs/iam.py
22
libs/iam.py
@@ -44,7 +44,7 @@ def check_root_account(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
if e.response['Error']['Code'] == 'NoSuchEntity':
|
||||
print("[-]: user '{}' likely doesnt have console access" .format(user['UserName']))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||
@@ -52,7 +52,7 @@ def check_root_account(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
if e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -69,7 +69,7 @@ def change_user_console_password(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, usern
|
||||
elif e.response['Error']['Code'] == 'NoSuchEntity':
|
||||
print("[-]: User likely doesnt have console access")
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -87,7 +87,7 @@ def create_user_console_password(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, usern
|
||||
elif e.response['Error']['Code'] == 'NoSuchEntity':
|
||||
print("[-]: User likely doesnt have console access")
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -100,7 +100,7 @@ def get_password_policy(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
print("Account Password Policy:")
|
||||
pp.pprint(pass_policy['PasswordPolicy'])
|
||||
except botocore.exceptions.ClientError as e:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -117,7 +117,7 @@ def create_user(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username):
|
||||
if e.response['Error']['Code'] == 'EntityAlreadyExists':
|
||||
print("ERROR: The provided user: {} already exists" .format(username))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -129,7 +129,7 @@ def create_access_key(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username):
|
||||
print("Creating a new access key for: {}" .format(username))
|
||||
pp.pprint(create_access_key['AccessKey'])
|
||||
except botocore.exceptions.ClientError as e:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -144,7 +144,7 @@ def delete_access_key(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username, access
|
||||
if e.response['Error']['Code'] == 'NoSuchEntity':
|
||||
print("ERROR: The provided AccessKey doesnt exist")
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -159,7 +159,7 @@ def delete_mfa_device(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username, mfaser
|
||||
if e.response['Error']['Code'] == 'NoSuchEntity':
|
||||
print("ERROR: The provided AccessKey doesnt exist")
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -176,7 +176,7 @@ def make_admin(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username):
|
||||
if e.response['Error']['Code'] == 'AccessDenied':
|
||||
print("ERROR: Account does not have permissions to add the policy")
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -191,6 +191,6 @@ def make_backdoor_account(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, username, pa
|
||||
create_access_key(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,username)
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -24,21 +24,21 @@ def describe_stacks(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#debug
|
||||
print response
|
||||
if response.get('Stacks') is None:
|
||||
print "{} likely does not have Lambda permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have Lambda permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['Stacks']) <= 0:
|
||||
print "[-] DescribeStacks allowed for {} but no results (everyone seems to have this permission) [-]\n" .format(region)
|
||||
print("[-] DescribeStacks allowed for {} but no results (everyone seems to have this permission) [-]\n" .format(region))
|
||||
else: #THIS PART IS UNTESTED
|
||||
for r in response['Stacks']:
|
||||
pp.pprint(r)
|
||||
except botocore.exceptions.EndpointConnectionError as e:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
|
||||
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'] == 'EndpointConnectionError':
|
||||
print "[-] Cant connect to the {} endpoint [-]" .format(region)
|
||||
print("[-] Cant connect to the {} endpoint [-]" .format(region))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
@@ -26,9 +26,9 @@ def list_geolocations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
#print response
|
||||
|
||||
if response.get('GeoLocationDetailsList') is None:
|
||||
print "{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have EMR permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['GeoLocationDetailsList']) <= 0:
|
||||
print "[-] ListGeoLocations allowed for {} but no results [-]" .format(region)
|
||||
print("[-] ListGeoLocations allowed for {} but no results [-]" .format(region))
|
||||
else:
|
||||
print"### {} Route53 GeoLocations ###" .format(region)
|
||||
for app in response['GeoLocationDetailsList']:
|
||||
@@ -41,7 +41,7 @@ def list_geolocations(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||
else:
|
||||
print "Unexpected error: {}" .format(e)
|
||||
print("Unexpected error: {}" .format(e))
|
||||
except KeyboardInterrupt:
|
||||
print("CTRL-C received, exiting...")
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ for region in regions:
|
||||
print_config_text(config_service_text)
|
||||
|
||||
if response.get('ConfigurationRecorders') is None:
|
||||
print "{} likely does not have Config permissions\n" .format(AWS_ACCESS_KEY_ID)
|
||||
print("{} likely does not have Config permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||
elif len(response['ConfigurationRecorders']) <= 0:
|
||||
print("NO CONFIGURATION DETECTED")
|
||||
else:
|
||||
|
||||
@@ -3,7 +3,7 @@ from libs.s3 import *
|
||||
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print "must specify bucket: {} <bucketname>".format(sys.argv[0])
|
||||
print("must specify bucket: {} <bucketname>".format(sys.argv[0]))
|
||||
sys.exit(-1)
|
||||
|
||||
#Attempt to list the contents of the bucket
|
||||
|
||||
Reference in New Issue
Block a user