pep8 and documentation
This commit is contained in:
14
libs/ce.py
14
libs/ce.py
@@ -9,7 +9,7 @@ import sys
|
|||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', ]
|
regions = ['us-east-1', ]
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -21,16 +21,20 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def ce_get_cost_and_usage():
|
def ce_get_cost_and_usage():
|
||||||
|
'''
|
||||||
|
Get cost and usage via cost explorer service - usually requires elevated prviliges
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('ce', region_name=region)
|
client = boto3.client('ce', region_name=region)
|
||||||
response = client.get_cost_and_usage(TimePeriod={'Start': '2018-01-01', 'End': '2018-04-01'}, Granularity='MONTHLY', Metrics=["BlendedCost", "UnblendedCost", "UsageQuantity"],)
|
response = client.get_cost_and_usage(TimePeriod={'Start': '2018-01-01', 'End': '2018-04-01'}, Granularity='MONTHLY', Metrics=["BlendedCost", "UnblendedCost", "UsageQuantity"],)
|
||||||
print(response)
|
print(response)
|
||||||
#if response.get('Services') is None:
|
# This module needs to be further tested
|
||||||
|
# if response.get('Services') is None:
|
||||||
# print("{} likely does not have Pricing permissions\n" .format(AWS_ACCESS_KEY_ID))
|
# print("{} likely does not have Pricing permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
#elif len(response['Services']) <= 0:
|
# elif len(response['Services']) <= 0:
|
||||||
# print("[-] Describe Pricing Services allowed for {} but no results [-]" .format(region))
|
# print("[-] Describe Pricing Services allowed for {} but no results [-]" .format(region))
|
||||||
#else:
|
# else:
|
||||||
# print("### {} Services ###" .format(region))
|
# print("### {} Services ###" .format(region))
|
||||||
# for tables in response['ServiceCode']:
|
# for tables in response['ServiceCode']:
|
||||||
# pp.pprint(tables)
|
# pp.pprint(tables)
|
||||||
@@ -39,7 +43,7 @@ def ce_get_cost_and_usage():
|
|||||||
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
||||||
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDeniedException':
|
elif e.response['Error']['Code'] == 'AccessDeniedException':
|
||||||
print('{} : (AccessDenied) when calling the Get Cost & Usage' .format(AWS_ACCESS_KEY_ID))
|
print('{} : (AccessDenied) when calling the Get Cost & Usage' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
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))
|
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
def cloudfront_list_distributions():
|
def cloudfront_list_distributions():
|
||||||
'''
|
'''
|
||||||
cloudfront list distributions
|
CloudFront list distributions
|
||||||
'''
|
'''
|
||||||
print("### Printing CloudFront Distributions ###")
|
print("### Printing CloudFront Distributions ###")
|
||||||
try:
|
try:
|
||||||
@@ -30,7 +30,7 @@ def cloudfront_list_distributions():
|
|||||||
client = boto3.client('cloudfront', region_name=region)
|
client = boto3.client('cloudfront', region_name=region)
|
||||||
|
|
||||||
response = client.list_distributions()
|
response = client.list_distributions()
|
||||||
#print(response)
|
# print(response)
|
||||||
if response.get('DistributionList') is None:
|
if response.get('DistributionList') is None:
|
||||||
print("{} likely does not have CloudFront permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have CloudFront permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['DistributionList']) <= 0:
|
elif len(response['DistributionList']) <= 0:
|
||||||
@@ -39,8 +39,7 @@ def cloudfront_list_distributions():
|
|||||||
print("### {} CloudFront Distributions ###" .format(region))
|
print("### {} CloudFront Distributions ###" .format(region))
|
||||||
for dist in response['DistributionList']['Items']:
|
for dist in response['DistributionList']['Items']:
|
||||||
pp.pprint(dist)
|
pp.pprint(dist)
|
||||||
|
# pp.pprint(dist['Items'][0])
|
||||||
#pp.pprint(dist['Items'][0])
|
|
||||||
print("\n")
|
print("\n")
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
@@ -53,5 +52,3 @@ def cloudfront_list_distributions():
|
|||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import sys
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1' ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1']
|
||||||
# 'cn-north-1', 'cn-northwest-1', 'us-gov-west-1' throwing An error occurred (UnrecognizedClientException) when calling the DescribeTrails operation: The security token included in the request is invalid.
|
# 'cn-north-1', 'cn-northwest-1', 'us-gov-west-1' throwing An error occurred (UnrecognizedClientException) when calling the DescribeTrails operation: The security token included in the request is invalid.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -30,11 +30,8 @@ def describe_trails():
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudtrail', region_name=region)
|
client = boto3.client('cloudtrail', region_name=region)
|
||||||
|
|
||||||
response = client.describe_trails()
|
response = client.describe_trails()
|
||||||
|
|
||||||
# print (response)
|
|
||||||
# print(region)
|
|
||||||
if response['trailList'] is None:
|
if response['trailList'] is None:
|
||||||
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['trailList']) <= 0:
|
elif len(response['trailList']) <= 0:
|
||||||
@@ -49,7 +46,7 @@ def describe_trails():
|
|||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||||
#elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
# elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
||||||
# pass
|
# pass
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
||||||
@@ -69,11 +66,8 @@ def list_public_keys():
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudtrail', region_name=region)
|
client = boto3.client('cloudtrail', region_name=region)
|
||||||
|
|
||||||
response = client.list_public_keys()
|
response = client.list_public_keys()
|
||||||
|
|
||||||
# print (response)
|
|
||||||
# print(region)
|
|
||||||
if response['PublicKeyList'] is None:
|
if response['PublicKeyList'] is None:
|
||||||
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['PublicKeyList']) <= 0:
|
elif len(response['PublicKeyList']) <= 0:
|
||||||
@@ -106,11 +100,8 @@ def stop_trail(TrailARN):
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudtrail', region_name=region)
|
client = boto3.client('cloudtrail', region_name=region)
|
||||||
|
|
||||||
response = client.describe_trails()
|
response = client.describe_trails()
|
||||||
|
|
||||||
# print(response)
|
|
||||||
|
|
||||||
if response['trailList'] is None:
|
if response['trailList'] is None:
|
||||||
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['trailList']) <= 0:
|
elif len(response['trailList']) <= 0:
|
||||||
@@ -130,7 +121,7 @@ def stop_trail(TrailARN):
|
|||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||||
#elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
# elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
||||||
# pass
|
# pass
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
||||||
@@ -141,6 +132,7 @@ def stop_trail(TrailARN):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def delete_trail(TrailARN):
|
def delete_trail(TrailARN):
|
||||||
'''
|
'''
|
||||||
Delete a specified trailARN
|
Delete a specified trailARN
|
||||||
@@ -150,11 +142,8 @@ def delete_trail(TrailARN):
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudtrail', region_name=region)
|
client = boto3.client('cloudtrail', region_name=region)
|
||||||
|
|
||||||
response = client.describe_trails()
|
response = client.describe_trails()
|
||||||
|
|
||||||
# print(response)
|
|
||||||
|
|
||||||
if response['trailList'] is None:
|
if response['trailList'] is None:
|
||||||
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have CloudTrail permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['trailList']) <= 0:
|
elif len(response['trailList']) <= 0:
|
||||||
@@ -174,7 +163,7 @@ def delete_trail(TrailARN):
|
|||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Does not have the required permissions' .format(AWS_ACCESS_KEY_ID))
|
||||||
#elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
# elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
# print('{} : UnrecognizedClientException error' .format(AWS_ACCESS_KEY_ID))
|
||||||
# pass
|
# pass
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import sys
|
|||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,14 +21,17 @@ credentials = session.get_credentials()
|
|||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
def describe_alarms():
|
def cloudwatch_describe_alarms():
|
||||||
|
'''
|
||||||
|
Describe CloudWatch alarms
|
||||||
|
'''
|
||||||
print("### Printing Cloudwatch Alarm Information ###")
|
print("### Printing Cloudwatch Alarm Information ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudwatch', region_name=region)
|
client = boto3.client('cloudwatch', region_name=region)
|
||||||
|
|
||||||
response = client.describe_alarms()
|
response = client.describe_alarms()
|
||||||
print ("### {} Alarms ###" .format(region))
|
print("### {} Alarms ###" .format(region))
|
||||||
for alarm in response['MetricAlarms']:
|
for alarm in response['MetricAlarms']:
|
||||||
pp.pprint(alarm)
|
pp.pprint(alarm)
|
||||||
print("\n")
|
print("\n")
|
||||||
@@ -46,20 +49,24 @@ def describe_alarms():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
def describe_alarm_history():
|
|
||||||
|
def cloudwatch_describe_alarm_history():
|
||||||
|
'''
|
||||||
|
Describe CloudWatch Alarm History
|
||||||
|
'''
|
||||||
print("### Printing Cloudwatch Alarm History Information ###")
|
print("### Printing Cloudwatch Alarm History Information ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudwatch', region_name=region)
|
client = boto3.client('cloudwatch', region_name=region)
|
||||||
|
|
||||||
response = client.describe_alarm_history()
|
response = client.describe_alarm_history()
|
||||||
#print response
|
# print(response)
|
||||||
if response.get('AlarmHistoryItems') is None:
|
if response.get('AlarmHistoryItems') is None:
|
||||||
print ("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['AlarmHistoryItems']) <= 0:
|
elif len(response['AlarmHistoryItems']) <= 0:
|
||||||
print ("[-] DecribeAlarmHistory allowed for {} but no results [-]" .format(region))
|
print("[-] DecribeAlarmHistory allowed for {} but no results [-]" .format(region))
|
||||||
else:
|
else:
|
||||||
print ("### {} Alarm History ###" .format(region))
|
print("### {} Alarm History ###" .format(region))
|
||||||
for history_item in response['AlarmHistoryItems']:
|
for history_item in response['AlarmHistoryItems']:
|
||||||
pp.pprint(history_item)
|
pp.pprint(history_item)
|
||||||
print("\n")
|
print("\n")
|
||||||
@@ -67,7 +74,7 @@ def describe_alarm_history():
|
|||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print ('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
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))
|
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'OptInRequired':
|
elif e.response['Error']['Code'] == 'OptInRequired':
|
||||||
@@ -77,20 +84,24 @@ def describe_alarm_history():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
def list_metrics():
|
|
||||||
|
def cloudwatch_list_metrics():
|
||||||
|
'''
|
||||||
|
List CloudWatch metrics
|
||||||
|
'''
|
||||||
print("### Printing Cloudwatch List Metrics ###")
|
print("### Printing Cloudwatch List Metrics ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('cloudwatch', region_name=region)
|
client = boto3.client('cloudwatch', region_name=region)
|
||||||
|
|
||||||
response = client.list_metrics()
|
response = client.list_metrics()
|
||||||
#print response
|
# print(response)
|
||||||
if response.get('Metrics') is None:
|
if response.get('Metrics') is None:
|
||||||
print ("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have cloudwatch permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif len(response['Metrics']) <= 0:
|
elif len(response['Metrics']) <= 0:
|
||||||
print ("[-] ListMetrics allowed for {} but no results [-]" .format(region))
|
print("[-] ListMetrics allowed for {} but no results [-]" .format(region))
|
||||||
else:
|
else:
|
||||||
print ("### Listing Metrics for {} ###" .format(region))
|
print("### Listing Metrics for {} ###" .format(region))
|
||||||
for metrics in response['Metrics']:
|
for metrics in response['Metrics']:
|
||||||
pp.pprint(metrics)
|
pp.pprint(metrics)
|
||||||
print("\n")
|
print("\n")
|
||||||
@@ -98,12 +109,12 @@ def list_metrics():
|
|||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print ('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Is NOT a root key' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'SubscriptionRequiredException':
|
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))
|
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
|
||||||
elif e.response['Error']['Code'] == 'OptInRequired':
|
elif e.response['Error']['Code'] == 'OptInRequired':
|
||||||
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
|
print('{} : Has permissions but isnt signed up for service - usually means you have a root account' .format(AWS_ACCESS_KEY_ID))
|
||||||
else:
|
else:
|
||||||
print ("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print ("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import sys
|
|||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,6 +21,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def describe_configuration_recorders(region):
|
def describe_configuration_recorders(region):
|
||||||
|
'''
|
||||||
|
Describe Config recorders
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client("config", region_name=region)
|
client = boto3.client("config", region_name=region)
|
||||||
|
|
||||||
@@ -32,13 +35,13 @@ def describe_configuration_recorders(region):
|
|||||||
print("No Recordings Found\n")
|
print("No Recordings Found\n")
|
||||||
else:
|
else:
|
||||||
for r in response['ConfigurationRecorders']:
|
for r in response['ConfigurationRecorders']:
|
||||||
for k,v in r.items():
|
for k, v in r.items():
|
||||||
print("%s: %s" % (k,v))
|
print("%s: %s" % (k, v))
|
||||||
print("\n")
|
print("\n")
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -55,6 +58,9 @@ def describe_configuration_recorders(region):
|
|||||||
|
|
||||||
|
|
||||||
def describe_configuration_rules(region):
|
def describe_configuration_rules(region):
|
||||||
|
'''
|
||||||
|
Describe Config rules
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client("config", region_name=region)
|
client = boto3.client("config", region_name=region)
|
||||||
|
|
||||||
@@ -66,13 +72,13 @@ def describe_configuration_rules(region):
|
|||||||
print("No Rules Found\n")
|
print("No Rules Found\n")
|
||||||
else:
|
else:
|
||||||
for r in response['ConfigRules']:
|
for r in response['ConfigRules']:
|
||||||
for k,v in r.items():
|
for k, v in r.items():
|
||||||
print("%s: %s" % (k,v))
|
print("%s: %s" % (k, v))
|
||||||
print("\n")
|
print("\n")
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -87,7 +93,11 @@ def describe_configuration_rules(region):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def delete_rule(rule_name, region):
|
def delete_rule(rule_name, region):
|
||||||
|
'''
|
||||||
|
Attempt to delete the specified Config Rule
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client("config", region_name=region)
|
client = boto3.client("config", region_name=region)
|
||||||
client.delete_config_rule(ConfigRuleName=rule_name)
|
client.delete_config_rule(ConfigRuleName=rule_name)
|
||||||
@@ -95,7 +105,7 @@ def delete_rule(rule_name, region):
|
|||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -110,7 +120,11 @@ def delete_rule(rule_name, region):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def delete_recorder(recorder_name, region):
|
def delete_recorder(recorder_name, region):
|
||||||
|
'''
|
||||||
|
Attempt to delete the specified Config recorder
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client("config", region_name=region)
|
client = boto3.client("config", region_name=region)
|
||||||
client.delete_configuration_recorder(ConfigurationRecorderName=recorder_name)
|
client.delete_configuration_recorder(ConfigurationRecorderName=recorder_name)
|
||||||
@@ -118,7 +132,7 @@ def delete_recorder(recorder_name, region):
|
|||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
elif e.response['Error']['Code'] == 'UnrecognizedClientException':
|
||||||
sys.exit("The AWS KEY IS INVALID. Exiting")
|
sys.exit("The AWS KEY IS INVALID. Exiting")
|
||||||
elif e.response['Error']['Code'] == 'AccessDenied':
|
elif e.response['Error']['Code'] == 'AccessDenied':
|
||||||
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
print('[-] {} : does not have config access. Did you check first?' .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -133,18 +147,34 @@ def delete_recorder(recorder_name, region):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def list_all_config_rules():
|
def list_all_config_rules():
|
||||||
|
'''
|
||||||
|
Get config rules for each region
|
||||||
|
'''
|
||||||
for region in regions:
|
for region in regions:
|
||||||
describe_configuration_rules(region)
|
describe_configuration_rules(region)
|
||||||
|
|
||||||
|
|
||||||
def list_all_config_recorders():
|
def list_all_config_recorders():
|
||||||
|
'''
|
||||||
|
Get recorders for each region
|
||||||
|
'''
|
||||||
for region in regions:
|
for region in regions:
|
||||||
describe_configuration_recorders(region)
|
describe_configuration_recorders(region)
|
||||||
|
|
||||||
|
|
||||||
def delete_config_rule(rule_name, region):
|
def delete_config_rule(rule_name, region):
|
||||||
|
'''
|
||||||
|
delete config rule (makes sure you passed a rule name)
|
||||||
|
'''
|
||||||
if rule_name:
|
if rule_name:
|
||||||
delete_rule(rule_name, region)
|
delete_rule(rule_name, region)
|
||||||
|
|
||||||
|
|
||||||
def delete_config_recorder(recorder_name, region):
|
def delete_config_recorder(recorder_name, region):
|
||||||
|
'''
|
||||||
|
delete config recorder (makes sure you passed a recorder name)
|
||||||
|
'''
|
||||||
if recorder_name:
|
if recorder_name:
|
||||||
delete_recorder(recorder_name, region)
|
delete_recorder(recorder_name, region)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ credentials = session.get_credentials()
|
|||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
def list_pipelines():
|
def datapipeline_list_pipelines():
|
||||||
'''
|
'''
|
||||||
Function to use the datapipeline boto3 library to list available pipelines
|
Function to use the datapipeline boto3 library to list available pipelines
|
||||||
'''
|
'''
|
||||||
|
|||||||
48
libs/ec2.py
48
libs/ec2.py
@@ -26,6 +26,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def review_encrypted_volumes():
|
def review_encrypted_volumes():
|
||||||
|
'''
|
||||||
|
EC2 review encrypted volumes (describe volumes and check to see if encrypted or not)
|
||||||
|
'''
|
||||||
print("Reviewing EC2 Volumes... This may take a few....")
|
print("Reviewing EC2 Volumes... This may take a few....")
|
||||||
not_encrypted = []
|
not_encrypted = []
|
||||||
encrypted = []
|
encrypted = []
|
||||||
@@ -72,12 +75,15 @@ def review_encrypted_volumes():
|
|||||||
|
|
||||||
|
|
||||||
def describe_instances():
|
def describe_instances():
|
||||||
|
'''
|
||||||
|
EC2 Describe Instances
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
response = client.describe_instances()
|
response = client.describe_instances()
|
||||||
#print(response)
|
# print(response)
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
||||||
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -113,6 +119,10 @@ def describe_instances():
|
|||||||
|
|
||||||
|
|
||||||
def describe_instances_basic():
|
def describe_instances_basic():
|
||||||
|
'''
|
||||||
|
Describe EC2 instances:
|
||||||
|
print("InstanceID: {}, InstanceType: {}, State: {}, Launchtime: {}".format(instanceid, instancetype, state, launchtime))
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -262,7 +272,7 @@ def ec2_list_launchable_ami():
|
|||||||
|
|
||||||
def ec2_list_owner_ami():
|
def ec2_list_owner_ami():
|
||||||
'''
|
'''
|
||||||
For each region list your AMI's Owners=['self']
|
For each region list your AMI's Owners=['self']
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
@@ -365,6 +375,9 @@ def get_instance_volume_details2():
|
|||||||
|
|
||||||
|
|
||||||
def describe_addresses():
|
def describe_addresses():
|
||||||
|
'''
|
||||||
|
Describe EC2 addresses (loop through all regions)
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -397,6 +410,9 @@ def describe_addresses():
|
|||||||
|
|
||||||
|
|
||||||
def describe_network_interfaces():
|
def describe_network_interfaces():
|
||||||
|
'''
|
||||||
|
Describe EC2 network interfaces (loop through all regions)
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -430,6 +446,9 @@ def describe_network_interfaces():
|
|||||||
|
|
||||||
|
|
||||||
def describe_route_tables():
|
def describe_route_tables():
|
||||||
|
'''
|
||||||
|
Describe EC2 route tables (loop through all regions)
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -463,6 +482,9 @@ def describe_route_tables():
|
|||||||
|
|
||||||
|
|
||||||
def get_console_screenshot(instanceid, region):
|
def get_console_screenshot(instanceid, region):
|
||||||
|
'''
|
||||||
|
Get console screenshot of the specified InstanceID in the specified region
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
print("[INFO] Checking for required permissions to screenshot: {} on {} [INFO]" .format(instanceid, region))
|
print("[INFO] Checking for required permissions to screenshot: {} on {} [INFO]" .format(instanceid, region))
|
||||||
@@ -488,6 +510,9 @@ def get_console_screenshot(instanceid, region):
|
|||||||
|
|
||||||
|
|
||||||
def get_console_screenshot_all():
|
def get_console_screenshot_all():
|
||||||
|
'''
|
||||||
|
loop through all regions and attempt to screenshot
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -543,6 +568,9 @@ def get_console_screenshot_all():
|
|||||||
|
|
||||||
|
|
||||||
def get_console_screenshot_all_region(region):
|
def get_console_screenshot_all_region(region):
|
||||||
|
'''
|
||||||
|
Attempt to get screenshots of all EC2 instances in a specified region
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
response = client.describe_instances()
|
response = client.describe_instances()
|
||||||
@@ -592,6 +620,10 @@ def get_console_screenshot_all_region(region):
|
|||||||
|
|
||||||
|
|
||||||
def get_console_screenshot_all_region_list(file, region):
|
def get_console_screenshot_all_region_list(file, region):
|
||||||
|
'''
|
||||||
|
Read a list of ec2 instanceIDs and attempt to screenshot them. They need to be in the same region
|
||||||
|
see write_instances_to_file to get a list of instances by region
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
|
|
||||||
@@ -631,6 +663,9 @@ def get_console_screenshot_all_region_list(file, region):
|
|||||||
|
|
||||||
|
|
||||||
def get_console_output(instanceid, region):
|
def get_console_output(instanceid, region):
|
||||||
|
'''
|
||||||
|
Attempt to get console output for specified instanceID and region
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
print("[INFO] Checking for required permissions to get console output: {} on {} [INFO]" .format(instanceid, region))
|
print("[INFO] Checking for required permissions to get console output: {} on {} [INFO]" .format(instanceid, region))
|
||||||
@@ -656,6 +691,9 @@ def get_console_output(instanceid, region):
|
|||||||
|
|
||||||
|
|
||||||
def get_console_output_all():
|
def get_console_output_all():
|
||||||
|
'''
|
||||||
|
loop through all regions and attempt to get console output
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
try:
|
try:
|
||||||
@@ -714,6 +752,9 @@ def get_console_output_all():
|
|||||||
|
|
||||||
|
|
||||||
def get_console_output_all_region(region):
|
def get_console_output_all_region(region):
|
||||||
|
'''
|
||||||
|
loop thorugh a region and attempt to get the console output
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
response = client.describe_instances()
|
response = client.describe_instances()
|
||||||
@@ -764,6 +805,9 @@ def get_console_output_all_region(region):
|
|||||||
|
|
||||||
|
|
||||||
def get_console_output_all_region_list(file, region):
|
def get_console_output_all_region_list(file, region):
|
||||||
|
'''
|
||||||
|
read in a file of instanceIDs for a region and attempt ot get the console output
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import sys
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,7 +21,7 @@ credentials = session.get_credentials()
|
|||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
def describe_repositories():
|
def ecr_describe_repositories():
|
||||||
'''
|
'''
|
||||||
Use ecr describe_repositories function to list available repositories
|
Use ecr describe_repositories function to list available repositories
|
||||||
'''
|
'''
|
||||||
@@ -29,11 +29,8 @@ def describe_repositories():
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('ecr', region_name=region)
|
client = boto3.client('ecr', region_name=region)
|
||||||
|
|
||||||
response = client.describe_repositories()
|
response = client.describe_repositories()
|
||||||
|
|
||||||
# print (response)
|
|
||||||
|
|
||||||
if response.get('repositories') is None:
|
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:
|
elif len(response['repositories']) <= 0:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import sys
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,15 +21,16 @@ credentials = session.get_credentials()
|
|||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
def describe_applications():
|
def elasticbeanstalk_describe_applications():
|
||||||
|
'''
|
||||||
|
Elasticbeanstalk Describe Applications
|
||||||
|
'''
|
||||||
print("### Printing ElasticBeanstalk Applications ###")
|
print("### Printing ElasticBeanstalk Applications ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('elasticbeanstalk', region_name=region)
|
client = boto3.client('elasticbeanstalk', region_name=region)
|
||||||
|
|
||||||
response = client.describe_applications()
|
response = client.describe_applications()
|
||||||
|
# print(response)
|
||||||
# print response
|
|
||||||
|
|
||||||
if response.get('Applications') is None:
|
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))
|
||||||
@@ -54,15 +55,16 @@ def describe_applications():
|
|||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_application_versions():
|
def elasticbeanstalk_describe_application_versions():
|
||||||
|
'''
|
||||||
|
Elasticbeanstalk Describe Application versions
|
||||||
|
'''
|
||||||
print("### Printing ElasticBeanstalk Applications Versions ###")
|
print("### Printing ElasticBeanstalk Applications Versions ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('elasticbeanstalk', region_name=region)
|
client = boto3.client('elasticbeanstalk', region_name=region)
|
||||||
|
|
||||||
response = client.describe_application_versions()
|
response = client.describe_application_versions()
|
||||||
|
# print(response)
|
||||||
# print response
|
|
||||||
|
|
||||||
if response.get('ApplicationVersions') is None:
|
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))
|
||||||
@@ -87,16 +89,17 @@ def describe_application_versions():
|
|||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_configuration_options():
|
def elasticbeanstalk_describe_configuration_options():
|
||||||
|
'''
|
||||||
|
Elasticbeanstalk Describe Configuration options
|
||||||
|
Currently not working
|
||||||
|
'''
|
||||||
print("### Printing ElasticBeanstalk Configuration Options ###")
|
print("### Printing ElasticBeanstalk Configuration Options ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('elasticbeanstalk', region_name=region)
|
client = boto3.client('elasticbeanstalk', region_name=region)
|
||||||
|
|
||||||
response = client.describe_configuration_options()
|
response = client.describe_configuration_options()
|
||||||
print(response)
|
# print(response)
|
||||||
|
|
||||||
# print response
|
|
||||||
|
|
||||||
if response.get('Options') is None:
|
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))
|
||||||
@@ -126,14 +129,15 @@ def describe_configuration_options():
|
|||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_environments():
|
def elasticbeanstalk_describe_environments():
|
||||||
|
'''
|
||||||
|
Elasticbeanstalk Describe Environments
|
||||||
|
'''
|
||||||
print("### Printing ElasticBeanstalk Environments ###")
|
print("### Printing ElasticBeanstalk Environments ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('elasticbeanstalk', region_name=region)
|
client = boto3.client('elasticbeanstalk', region_name=region)
|
||||||
|
|
||||||
response = client.describe_environments()
|
response = client.describe_environments()
|
||||||
|
|
||||||
# print response
|
# print response
|
||||||
|
|
||||||
if response.get('Environments') is None:
|
if response.get('Environments') is None:
|
||||||
@@ -159,14 +163,15 @@ def describe_environments():
|
|||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_events():
|
def elasticbeanstalk_describe_events():
|
||||||
|
'''
|
||||||
|
Elasticbeanstalk Describe Events
|
||||||
|
'''
|
||||||
print("### Printing ElasticBeanstalk Environments ###")
|
print("### Printing ElasticBeanstalk Environments ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('elasticbeanstalk', region_name=region)
|
client = boto3.client('elasticbeanstalk', region_name=region)
|
||||||
|
|
||||||
response = client.describe_events()
|
response = client.describe_events()
|
||||||
|
|
||||||
# print(response)
|
# print(response)
|
||||||
|
|
||||||
if response.get('Events') is None:
|
if response.get('Events') is None:
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def list_clusters():
|
def list_clusters():
|
||||||
|
'''
|
||||||
|
List EMR Clusters
|
||||||
|
'''
|
||||||
print("### Printing EMR Clusters ###")
|
print("### Printing EMR Clusters ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('emr', region_name=region)
|
client = boto3.client('emr', region_name=region)
|
||||||
|
|
||||||
response = client.list_clusters()
|
response = client.list_clusters()
|
||||||
|
|
||||||
if response.get('Clusters') is None:
|
if response.get('Clusters') is None:
|
||||||
@@ -53,13 +55,14 @@ def list_clusters():
|
|||||||
|
|
||||||
|
|
||||||
def list_security_configurations():
|
def list_security_configurations():
|
||||||
|
'''
|
||||||
|
List EMR Security Configurations
|
||||||
|
'''
|
||||||
print("### Printing EMR Security Configuration ###")
|
print("### Printing EMR Security Configuration ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('emr', region_name=region)
|
client = boto3.client('emr', region_name=region)
|
||||||
|
|
||||||
response = client.list_security_configurations()
|
response = client.list_security_configurations()
|
||||||
|
|
||||||
# print(response)
|
# print(response)
|
||||||
|
|
||||||
if response.get('SecurityConfigurations') is None:
|
if response.get('SecurityConfigurations') is None:
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ def firehose_list_delivery_streams():
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('firehose', region_name=region)
|
client = boto3.client('firehose', region_name=region)
|
||||||
|
|
||||||
response = client.list_delivery_streams()
|
response = client.list_delivery_streams()
|
||||||
|
|
||||||
# print(response)
|
# print(response)
|
||||||
@@ -63,7 +62,6 @@ def firehose_describe_delivery_streams():
|
|||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('firehose', region_name=region)
|
client = boto3.client('firehose', region_name=region)
|
||||||
|
|
||||||
response = client.list_delivery_streams()
|
response = client.list_delivery_streams()
|
||||||
|
|
||||||
# print(response)
|
# print(response)
|
||||||
@@ -74,9 +72,9 @@ def firehose_describe_delivery_streams():
|
|||||||
else:
|
else:
|
||||||
print("### {} Firehose Delivery Streams ###" .format(region))
|
print("### {} Firehose Delivery Streams ###" .format(region))
|
||||||
for stream in response['DeliveryStreamNames']:
|
for stream in response['DeliveryStreamNames']:
|
||||||
details = client.describe_delivery_stream(DeliveryStreamName=stream)
|
details = client.describe_delivery_stream(DeliveryStreamName=stream)
|
||||||
# This just prints the blob, needs to be cleaned up
|
# This just prints the blob, needs to be cleaned up
|
||||||
print(details)
|
print(details)
|
||||||
print("\n")
|
print("\n")
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ def get_password_policy():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def get_account_authorization_details():
|
def get_account_authorization_details():
|
||||||
'''
|
'''
|
||||||
Get the account authoirzation details
|
Get the account authoirzation details
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pp = pprint.PrettyPrinter(indent=5, width=80)
|
|||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
# http://docs.aws.amazon.com/general/latest/gr/rande.html#opsworks_region
|
# http://docs.aws.amazon.com/general/latest/gr/rande.html#opsworks_region
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-1', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1' ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-1', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,6 +21,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def describe_stacks():
|
def describe_stacks():
|
||||||
|
'''
|
||||||
|
Opsworks decribe stacks
|
||||||
|
'''
|
||||||
print('#### Listing Stacks ####')
|
print('#### Listing Stacks ####')
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
@@ -29,7 +32,6 @@ def describe_stacks():
|
|||||||
region_name=region
|
region_name=region
|
||||||
)
|
)
|
||||||
response = client.describe_stacks()
|
response = client.describe_stacks()
|
||||||
# debug
|
|
||||||
# print(response)
|
# print(response)
|
||||||
if response.get('Stacks') is None:
|
if response.get('Stacks') is None:
|
||||||
print("{} likely does not have Opsworks permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have Opsworks permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -55,6 +57,9 @@ def describe_stacks():
|
|||||||
|
|
||||||
|
|
||||||
def describe_user_profiles():
|
def describe_user_profiles():
|
||||||
|
'''
|
||||||
|
Opsworks describe user profiles
|
||||||
|
'''
|
||||||
print('#### Listing User Profiles ####')
|
print('#### Listing User Profiles ####')
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
@@ -65,11 +70,11 @@ def describe_user_profiles():
|
|||||||
response = client.describe_user_profiles()
|
response = client.describe_user_profiles()
|
||||||
# debug
|
# debug
|
||||||
print(response)
|
print(response)
|
||||||
#if response.get('Stacks') is None:
|
# 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:
|
# 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
|
# else: # THIS PART IS UNTESTED
|
||||||
# for r in response['Stacks']:
|
# for r in response['Stacks']:
|
||||||
# pp.pprint(r)
|
# pp.pprint(r)
|
||||||
except botocore.exceptions.EndpointConnectionError as e:
|
except botocore.exceptions.EndpointConnectionError as e:
|
||||||
@@ -86,5 +91,3 @@ def describe_user_profiles():
|
|||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import sys
|
|||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'ap-south-1' ]
|
regions = ['us-east-1', 'ap-south-1']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -21,6 +21,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def pricing_describe_services():
|
def pricing_describe_services():
|
||||||
|
'''
|
||||||
|
Using pricing service describe services
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client('pricing', region_name=region)
|
client = boto3.client('pricing', region_name=region)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import pprint
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -20,6 +20,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def describe_db_instances():
|
def describe_db_instances():
|
||||||
|
'''
|
||||||
|
RDS describe DB instances
|
||||||
|
'''
|
||||||
print("### Printing RDS DB instances ###")
|
print("### Printing RDS DB instances ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import sys
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2']
|
||||||
|
|
||||||
region_single = ['us-east-1']
|
region_single = ['us-east-1']
|
||||||
|
|
||||||
@@ -24,15 +24,16 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def list_geolocations():
|
def list_geolocations():
|
||||||
|
'''
|
||||||
|
Route53 list geolocations
|
||||||
|
'''
|
||||||
print("### Printing Route53 GeoLocations ###")
|
print("### Printing Route53 GeoLocations ###")
|
||||||
try:
|
try:
|
||||||
#cheating because they are all the same for this function call
|
# cheating because they are all the same for this function call
|
||||||
for region in region_single:
|
for region in region_single:
|
||||||
client = boto3.client('route53', region_name=region)
|
client = boto3.client('route53', region_name=region)
|
||||||
|
|
||||||
response = client.list_geo_locations()
|
response = client.list_geo_locations()
|
||||||
|
# print(response)
|
||||||
#print response
|
|
||||||
|
|
||||||
if response.get('GeoLocationDetailsList') is None:
|
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))
|
||||||
@@ -56,4 +57,4 @@ def list_geolocations():
|
|||||||
else:
|
else:
|
||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Code to get the AWS_ACCESS_KEY_ID from boto3
|
|||||||
session = boto3.Session()
|
session = boto3.Session()
|
||||||
credentials = session.get_credentials()
|
credentials = session.get_credentials()
|
||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
AWS_SECRET_ACCESS_KEY = credentials.secret_key
|
||||||
|
|
||||||
|
|
||||||
def get_s3bucket_policy(bucket):
|
def get_s3bucket_policy(bucket):
|
||||||
@@ -161,7 +162,7 @@ def get_s3objects_for_account_detailed():
|
|||||||
print('#### Trying to list s3 bucketsfor {} ####\n '.format(AWS_ACCESS_KEY_ID))
|
print('#### Trying to list s3 bucketsfor {} ####\n '.format(AWS_ACCESS_KEY_ID))
|
||||||
for bucket in client.buckets.all():
|
for bucket in client.buckets.all():
|
||||||
print(bucket.name)
|
print(bucket.name)
|
||||||
get_s3bucket_policy(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,bucket.name)
|
get_s3bucket_policy(bucket.name)
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
|
|||||||
23
libs/ses.py
23
libs/ses.py
@@ -9,7 +9,7 @@ import pprint
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-west-2', 'eu-west-1' ]
|
regions = ['us-east-1', 'us-west-2', 'eu-west-1']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -20,7 +20,10 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def list_identities():
|
def list_identities():
|
||||||
print("### Printing SES Identifies ###")
|
'''
|
||||||
|
SES List identities
|
||||||
|
'''
|
||||||
|
print("### Printing SES Identities ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client(
|
client = boto3.client(
|
||||||
@@ -37,7 +40,6 @@ def list_identities():
|
|||||||
else:
|
else:
|
||||||
print("### {} SES Identities ###" .format(region))
|
print("### {} SES Identities ###" .format(region))
|
||||||
for r in response['Identities']:
|
for r in response['Identities']:
|
||||||
#for i in r['Instances']:
|
|
||||||
pp.pprint(r)
|
pp.pprint(r)
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
@@ -53,8 +55,12 @@ def list_identities():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def get_send_statistics():
|
def get_send_statistics():
|
||||||
print("### Printing SES Identifies ###")
|
'''
|
||||||
|
SES get send statistics
|
||||||
|
'''
|
||||||
|
print("### Printing SES Send Statistics ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client(
|
client = boto3.client(
|
||||||
@@ -71,7 +77,6 @@ def get_send_statistics():
|
|||||||
else:
|
else:
|
||||||
print("### {} SES Send Statistics ###" .format(region))
|
print("### {} SES Send Statistics ###" .format(region))
|
||||||
for r in response['SendDataPoints']:
|
for r in response['SendDataPoints']:
|
||||||
#for i in r['Instances']:
|
|
||||||
pp.pprint(r)
|
pp.pprint(r)
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
@@ -87,8 +92,12 @@ def get_send_statistics():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def list_configuration_sets():
|
def list_configuration_sets():
|
||||||
print("### Printing SES Identifies ###")
|
'''
|
||||||
|
SES List configuration sets
|
||||||
|
'''
|
||||||
|
print("### Printing SES Configuration Sets ###")
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client(
|
client = boto3.client(
|
||||||
@@ -105,7 +114,6 @@ def list_configuration_sets():
|
|||||||
else:
|
else:
|
||||||
print("### {} SES Configuration Sets ###" .format(region))
|
print("### {} SES Configuration Sets ###" .format(region))
|
||||||
for r in response['ConfigurationSets']:
|
for r in response['ConfigurationSets']:
|
||||||
#for i in r['Instances']:
|
|
||||||
pp.pprint(r)
|
pp.pprint(r)
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
@@ -120,4 +128,3 @@ def list_configuration_sets():
|
|||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|||||||
36
libs/sql.py
36
libs/sql.py
@@ -5,17 +5,17 @@ Custom SQL/database functions for WeirdAAL
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from sqlite3 import Error
|
from sqlite3 import Error
|
||||||
|
|
||||||
def create_table(db_name,table_name,sql):
|
|
||||||
|
def create_table(db_name, table_name, sql):
|
||||||
'''
|
'''
|
||||||
SQLite3 create table function
|
SQLite3 create table function
|
||||||
'''
|
'''
|
||||||
with sqlite3.connect(db_name) as db:
|
with sqlite3.connect(db_name) as db:
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""SELECT name FROM sqlite_master WHERE name=?""",(table_name,))
|
cursor.execute("""SELECT name FROM sqlite_master WHERE name=?""", (table_name,))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
keep_table = True
|
keep_table = True
|
||||||
if len(result) == 1:
|
if len(result) == 1:
|
||||||
#python 3
|
|
||||||
response = input("The table {} already exists, do you wish to recreate it? (y/n): ".format(table_name))
|
response = input("The table {} already exists, do you wish to recreate it? (y/n): ".format(table_name))
|
||||||
if response == "y":
|
if response == "y":
|
||||||
keep_table = False
|
keep_table = False
|
||||||
@@ -43,9 +43,9 @@ def create_recon_table(db_name, table_name):
|
|||||||
target text,
|
target text,
|
||||||
checked_at timestamp,
|
checked_at timestamp,
|
||||||
PRIMARY KEY (ID))"""
|
PRIMARY KEY (ID))"""
|
||||||
#FOREIGN KEY (AWSKeyID) references AWSKey(ID))"""
|
# FOREIGN KEY (AWSKeyID) references AWSKey(ID))"""
|
||||||
create_table(db_name,table_name,sql)
|
create_table(db_name, table_name, sql)
|
||||||
print ("created table: {}".format(table_name))
|
print("created table: {}".format(table_name))
|
||||||
|
|
||||||
|
|
||||||
def create_awskey_table(db_name, table_name):
|
def create_awskey_table(db_name, table_name):
|
||||||
@@ -58,8 +58,8 @@ def create_awskey_table(db_name, table_name):
|
|||||||
description text,
|
description text,
|
||||||
target text,
|
target text,
|
||||||
PRIMARY KEY(ID))"""
|
PRIMARY KEY(ID))"""
|
||||||
create_table(db_name,table_name,sql)
|
create_table(db_name, table_name, sql)
|
||||||
print ("created table: {}".format(table_name))
|
print("created table: {}".format(table_name))
|
||||||
|
|
||||||
|
|
||||||
def create_services_table(db_name, table_name):
|
def create_services_table(db_name, table_name):
|
||||||
@@ -75,8 +75,8 @@ def create_services_table(db_name, table_name):
|
|||||||
checked_at timestamp,
|
checked_at timestamp,
|
||||||
target text,
|
target text,
|
||||||
PRIMARY KEY(ID))"""
|
PRIMARY KEY(ID))"""
|
||||||
create_table(db_name,table_name,sql)
|
create_table(db_name, table_name, sql)
|
||||||
print ("created table: {}".format(table_name))
|
print("created table: {}".format(table_name))
|
||||||
|
|
||||||
|
|
||||||
def insert_awskey_data(db_name, records):
|
def insert_awskey_data(db_name, records):
|
||||||
@@ -85,7 +85,7 @@ def insert_awskey_data(db_name, records):
|
|||||||
'''
|
'''
|
||||||
sql = """INSERT INTO AWSKey(AWSKeyID, description, target) VALUES (?,?,?)"""
|
sql = """INSERT INTO AWSKey(AWSKeyID, description, target) VALUES (?,?,?)"""
|
||||||
for record in records:
|
for record in records:
|
||||||
query(db_name, sql,record)
|
query(db_name, sql, record)
|
||||||
|
|
||||||
|
|
||||||
def insert_reconservice_data(db_name, records):
|
def insert_reconservice_data(db_name, records):
|
||||||
@@ -94,7 +94,7 @@ def insert_reconservice_data(db_name, records):
|
|||||||
'''
|
'''
|
||||||
sql = """INSERT INTO recon(service, sub_service, AWSKeyID, target, checked_at) VALUES (?,?,?,?,?)"""
|
sql = """INSERT INTO recon(service, sub_service, AWSKeyID, target, checked_at) VALUES (?,?,?,?,?)"""
|
||||||
for record in records:
|
for record in records:
|
||||||
query(db_name,sql,record)
|
query(db_name, sql, record)
|
||||||
|
|
||||||
|
|
||||||
def insert_sub_service_data(db_name, records):
|
def insert_sub_service_data(db_name, records):
|
||||||
@@ -103,26 +103,26 @@ def insert_sub_service_data(db_name, records):
|
|||||||
'''
|
'''
|
||||||
sql = """INSERT INTO services(service, sub_service, sub_service_data, AWSKeyID, target, checked_at) VALUES (?,?,?,?,?,?)"""
|
sql = """INSERT INTO services(service, sub_service, sub_service_data, AWSKeyID, target, checked_at) VALUES (?,?,?,?,?,?)"""
|
||||||
for record in records:
|
for record in records:
|
||||||
query(db_name,sql,record)
|
query(db_name, sql, record)
|
||||||
|
|
||||||
|
|
||||||
def search_recon_by_key(db_name,AWSKeyID):
|
def search_recon_by_key(db_name, AWSKeyID):
|
||||||
'''
|
'''
|
||||||
Function to query services by AWSKey and order them by time
|
Function to query services by AWSKey and order them by time
|
||||||
'''
|
'''
|
||||||
with sqlite3.connect(db_name) as db:
|
with sqlite3.connect(db_name) as db:
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""SELECT DISTINCT service, sub_service, checked_at FROM recon WHERE AWSKeyID=? ORDER BY datetime(checked_at)""",(AWSKeyID,))
|
cursor.execute("""SELECT DISTINCT service, sub_service, checked_at FROM recon WHERE AWSKeyID=? ORDER BY datetime(checked_at)""", (AWSKeyID,))
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def query(db_name,sql,data):
|
def query(db_name, sql, data):
|
||||||
'''
|
'''
|
||||||
Generic query function
|
Generic query function
|
||||||
'''
|
'''
|
||||||
with sqlite3.connect(db_name) as db:
|
with sqlite3.connect(db_name) as db:
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
#cursor.execute("""PRAGMA foreign_keys = ON""")
|
# cursor.execute("""PRAGMA foreign_keys = ON""")
|
||||||
cursor.execute(sql,data)
|
cursor.execute(sql, data)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import pprint
|
|||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
# from https://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region
|
# from https://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'cn-north-1', 'cn-northwest-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1', 'us-gov-west-1' ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-southeast-1', 'ap-southeast-2', 'ca-central-1', 'cn-north-1', 'cn-northwest-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'sa-east-1', 'us-gov-west-1']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -20,6 +20,9 @@ AWS_ACCESS_KEY_ID = credentials.access_key
|
|||||||
|
|
||||||
|
|
||||||
def sqs_list_queues():
|
def sqs_list_queues():
|
||||||
|
'''
|
||||||
|
SQS List Queues
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
for region in regions:
|
for region in regions:
|
||||||
client = boto3.client("sqs", region_name=region)
|
client = boto3.client("sqs", region_name=region)
|
||||||
@@ -45,4 +48,3 @@ def sqs_list_queues():
|
|||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ def sts_get_accountid_all():
|
|||||||
account_userid = client.get_caller_identity()["UserId"]
|
account_userid = client.get_caller_identity()["UserId"]
|
||||||
account_arn = client.get_caller_identity()["Arn"]
|
account_arn = client.get_caller_identity()["Arn"]
|
||||||
print("Account Id: {}" .format(account_id))
|
print("Account Id: {}" .format(account_id))
|
||||||
print("Account UserID: {}" .format(account_userid) )
|
print("Account UserID: {}" .format(account_userid))
|
||||||
print("Account ARN: {}" .format(account_arn) )
|
print("Account ARN: {}" .format(account_arn))
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
if e.response['Error']['Code'] == 'InvalidClientTokenId':
|
||||||
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
sys.exit("{} : The AWS KEY IS INVALID. Exiting" .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -67,4 +67,4 @@ def sts_get_accountid_all():
|
|||||||
print("Unexpected error: {}" .format(e))
|
print("Unexpected error: {}" .format(e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
return account_id
|
return account_id
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import sys
|
|||||||
|
|
||||||
pp = pprint.PrettyPrinter(indent=5, width=80)
|
pp = pprint.PrettyPrinter(indent=5, width=80)
|
||||||
|
|
||||||
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
# from http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||||
regions = ['us-east-1', 'us-east-2', 'us-west-2', 'eu-west-1' ]
|
regions = ['us-east-1', 'us-east-2', 'us-west-2', 'eu-west-1']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Code to get the AWS_ACCESS_KEY_ID from boto3
|
Code to get the AWS_ACCESS_KEY_ID from boto3
|
||||||
@@ -20,6 +20,7 @@ session = boto3.Session()
|
|||||||
credentials = session.get_credentials()
|
credentials = session.get_credentials()
|
||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
def translate_text(text, source_lang, target_lang):
|
def translate_text(text, source_lang, target_lang):
|
||||||
'''
|
'''
|
||||||
Translate a block of text from source to target language
|
Translate a block of text from source to target language
|
||||||
@@ -38,7 +39,6 @@ def translate_text(text, source_lang, target_lang):
|
|||||||
else:
|
else:
|
||||||
print("### {}: Translated Text ###\n" .format(region))
|
print("### {}: Translated Text ###\n" .format(region))
|
||||||
print("Translated Text: {}".format(response['TranslatedText']))
|
print("Translated Text: {}".format(response['TranslatedText']))
|
||||||
|
|
||||||
print("\n")
|
print("\n")
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
if e.response['Error']['Code'] == 'UnauthorizedOperation':
|
||||||
@@ -48,4 +48,4 @@ def translate_text(text, source_lang, target_lang):
|
|||||||
else:
|
else:
|
||||||
print(e)
|
print(e)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|||||||
@@ -5,10 +5,18 @@ from libs.aws_lambda import *
|
|||||||
|
|
||||||
|
|
||||||
def module_lambda_list_functions():
|
def module_lambda_list_functions():
|
||||||
|
'''
|
||||||
|
List Lambda functions
|
||||||
|
python3 weirdAAL.py -m lambda_list_functions -t demo
|
||||||
|
'''
|
||||||
list_functions()
|
list_functions()
|
||||||
|
|
||||||
|
|
||||||
def module_lambda_list_event_source_mappings():
|
def module_lambda_list_event_source_mappings():
|
||||||
|
'''
|
||||||
|
List Lambda event source mappings
|
||||||
|
python3 weirdAAL.py -m lambda_list_event_source_mappings -t demo
|
||||||
|
'''
|
||||||
list_event_source_mappings()
|
list_event_source_mappings()
|
||||||
|
|
||||||
|
|
||||||
@@ -23,5 +31,6 @@ def module_lambda_get_function(*text):
|
|||||||
def module_lambda_get_account_settings():
|
def module_lambda_get_account_settings():
|
||||||
'''
|
'''
|
||||||
Returns a customer's account settings.
|
Returns a customer's account settings.
|
||||||
|
python3 weirdAAL.py -m lambda_get_account_settings -t demo
|
||||||
'''
|
'''
|
||||||
lambda_get_account_settings()
|
lambda_get_account_settings()
|
||||||
|
|||||||
@@ -7,5 +7,9 @@ permission to get anything from this
|
|||||||
from libs.ce import *
|
from libs.ce import *
|
||||||
|
|
||||||
|
|
||||||
def module_cost_explorer_get_cost_and_usage():
|
def module_costexplorer_get_cost_and_usage():
|
||||||
ce_get_cost_and_usage()
|
'''
|
||||||
|
Attempt to list cost and usage via the Cost Explorer service
|
||||||
|
python3 weirdAAL.py -m costexplorer_get_cost_and_usage -t demo
|
||||||
|
'''
|
||||||
|
ce_get_cost_and_usage()
|
||||||
|
|||||||
@@ -6,5 +6,8 @@ from libs.cloudfront import *
|
|||||||
|
|
||||||
|
|
||||||
def module_cloudfront_list_distributions():
|
def module_cloudfront_list_distributions():
|
||||||
|
'''
|
||||||
|
List CloudFront distributions
|
||||||
|
python3 weirdAAL.py -m cloudfront_list_distributions -t demo
|
||||||
|
'''
|
||||||
cloudfront_list_distributions()
|
cloudfront_list_distributions()
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,32 @@ from libs.cloudtrail import *
|
|||||||
|
|
||||||
|
|
||||||
def module_cloudtrail_describe_trails():
|
def module_cloudtrail_describe_trails():
|
||||||
|
'''
|
||||||
|
Describe CloudTrail trails
|
||||||
|
python3 weirdAAL.py -m cloudtrail_describe_trails -t demo
|
||||||
|
'''
|
||||||
describe_trails()
|
describe_trails()
|
||||||
|
|
||||||
|
|
||||||
def module_cloudtrail_list_public_keys():
|
def module_cloudtrail_list_public_keys():
|
||||||
|
'''
|
||||||
|
List public keys associated with the CloudTrail account
|
||||||
|
python3 weirdAAL.py -m cloudtrail_list_public_keys -t demo
|
||||||
|
'''
|
||||||
list_public_keys()
|
list_public_keys()
|
||||||
|
|
||||||
|
|
||||||
def module_cloudtrail_stop_trail(TrailARN):
|
def module_cloudtrail_stop_trail(TrailARN):
|
||||||
|
'''
|
||||||
|
Stop a specified CloudTrail ARN
|
||||||
|
python3 weirdAAL.py -m cloudtrail_stop_trail -a arn:aws:cloudtrail:us-east-1... -t demo
|
||||||
|
'''
|
||||||
stop_trail(TrailARN)
|
stop_trail(TrailARN)
|
||||||
|
|
||||||
|
|
||||||
def module_cloudtrail_delete_trail(TrailARN):
|
def module_cloudtrail_delete_trail(TrailARN):
|
||||||
delete_trail(TrailARN)
|
'''
|
||||||
|
Delete a specified CloudTrail ARN
|
||||||
|
python3 weirdAAL.py -m cloudtrail_delete_trail -a arn:aws:cloudtrail:us-east-1... -t demo
|
||||||
|
'''
|
||||||
|
delete_trail(TrailARN)
|
||||||
|
|||||||
@@ -6,10 +6,24 @@ from libs.cloudwatch import *
|
|||||||
|
|
||||||
|
|
||||||
def module_cloudwatch_describe_alarms():
|
def module_cloudwatch_describe_alarms():
|
||||||
describe_alarms()
|
'''
|
||||||
|
Describe CloudWatch Alarms
|
||||||
|
python3 weirdAAL.py -m cloudwatch_describe_alarms -t demo
|
||||||
|
'''
|
||||||
|
cloudwatch_describe_alarms()
|
||||||
|
|
||||||
|
|
||||||
def module_cloudwatch_describe_alarm_history():
|
def module_cloudwatch_describe_alarm_history():
|
||||||
describe_alarm_history()
|
'''
|
||||||
|
Describe CloudWatch Alarm History
|
||||||
|
python3 weirdAAL.py -m cloudwatch_describe_alarm_history -t demo
|
||||||
|
'''
|
||||||
|
cloudwatch_describe_alarm_history()
|
||||||
|
|
||||||
|
|
||||||
def module_cloudwatch_list_metrics():
|
def module_cloudwatch_list_metrics():
|
||||||
list_metrics()
|
'''
|
||||||
|
CloudWatch List Metrics
|
||||||
|
python3 weirdAAL.py -m cloudwatch_list_metrics -t demo
|
||||||
|
'''
|
||||||
|
cloudwatch_list_metrics()
|
||||||
|
|||||||
@@ -4,20 +4,40 @@ Module for interacting with the config service
|
|||||||
|
|
||||||
from libs.config import *
|
from libs.config import *
|
||||||
|
|
||||||
|
|
||||||
def module_config_list_all_rules():
|
def module_config_list_all_rules():
|
||||||
|
'''
|
||||||
|
Config list all rules
|
||||||
|
python3 weirdAAL.py -m config_list_all_rules -t demo
|
||||||
|
'''
|
||||||
list_all_config_rules()
|
list_all_config_rules()
|
||||||
|
|
||||||
|
|
||||||
def module_config_list_all_recorders():
|
def module_config_list_all_recorders():
|
||||||
|
'''
|
||||||
|
Config list all recorders
|
||||||
|
python3 weirdAAL.py -m config_list_all_recorders -t demo
|
||||||
|
'''
|
||||||
list_all_config_recorders()
|
list_all_config_recorders()
|
||||||
|
|
||||||
|
|
||||||
def module_config_delete_rule(*args):
|
def module_config_delete_rule(*args):
|
||||||
|
'''
|
||||||
|
Config delete the specified rule
|
||||||
|
python3 weirdAAL.py -m config_delete_rule -a someRuleName,us-east-1 -t demo
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
if args[0][0] and args[0][1]:
|
if args[0][0] and args[0][1]:
|
||||||
delete_config_rule(args[0][0], args[0][1])
|
delete_config_rule(args[0][0], args[0][1])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("You must provide the rule name and region name: -a someRuleName,us-east-1")
|
print("You must provide the rule name and region name: -a someRuleName,us-east-1")
|
||||||
|
|
||||||
|
|
||||||
def module_config_delete_recorder(*args):
|
def module_config_delete_recorder(*args):
|
||||||
|
'''
|
||||||
|
Config delete the specified recorder
|
||||||
|
python3 weirdAAL.py -m config_delete_recorder -a someRecorderName,us-east-1 -t demo
|
||||||
|
'''
|
||||||
try:
|
try:
|
||||||
if args[0][0] and args[0][1]:
|
if args[0][0] and args[0][1]:
|
||||||
delete_config_recorder(args[0][0], args[0][1])
|
delete_config_recorder(args[0][0], args[0][1])
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from libs.datapipeline import *
|
|||||||
|
|
||||||
def module_datapipeline_list_pipelines():
|
def module_datapipeline_list_pipelines():
|
||||||
'''
|
'''
|
||||||
List Pipelines
|
List DataPileLine pipelines
|
||||||
|
python3 weirdAAL.py -m datapipeline_list_pipelines -t demo
|
||||||
'''
|
'''
|
||||||
list_pipelines()
|
datapipeline_list_pipelines()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ credentials = session.get_credentials()
|
|||||||
AWS_ACCESS_KEY_ID = credentials.access_key
|
AWS_ACCESS_KEY_ID = credentials.access_key
|
||||||
|
|
||||||
|
|
||||||
# for a key, what services does it have listed in the DB
|
# for a key, what services does it have listed in the DB
|
||||||
|
|
||||||
|
|
||||||
def module_show_services_by_key():
|
def module_show_services_by_key():
|
||||||
|
|||||||
@@ -5,7 +5,16 @@ from libs.dynamodb import *
|
|||||||
|
|
||||||
|
|
||||||
def module_dynamodb_list_tables():
|
def module_dynamodb_list_tables():
|
||||||
|
'''
|
||||||
|
DynamoDB list tables
|
||||||
|
python3 weirdAAL.py -m dynamodb_list_tables -t demo
|
||||||
|
'''
|
||||||
list_dynamodb_tables()
|
list_dynamodb_tables()
|
||||||
|
|
||||||
|
|
||||||
def module_dynamodb_list_tables_detailed():
|
def module_dynamodb_list_tables_detailed():
|
||||||
|
'''
|
||||||
|
DynamoDB list tables detailed - also tries decribe_tables on each table
|
||||||
|
python3 weirdAAL.py -m dynamodb_list_tables_detailed -t demo
|
||||||
|
'''
|
||||||
list_dynamodb_tables_detailed()
|
list_dynamodb_tables_detailed()
|
||||||
|
|||||||
@@ -5,4 +5,8 @@ from libs.dynamodbstreams import *
|
|||||||
|
|
||||||
|
|
||||||
def module_dynamodbstreams_list_streams():
|
def module_dynamodbstreams_list_streams():
|
||||||
list_dynamodbstreams()
|
'''
|
||||||
|
List dynamodbstream streams
|
||||||
|
python3 weirdAAL.py -m dynamodbstreams_list_streams -t demo
|
||||||
|
'''
|
||||||
|
list_dynamodbstreams()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ def module_ec2_describe_instances_basic():
|
|||||||
ex:
|
ex:
|
||||||
[+] Listing instances for region: us-west-2 [+]
|
[+] Listing instances for region: us-west-2 [+]
|
||||||
InstanceID: i-XXXXXXXXXXXXXXX, InstanceType: t2.micro, State: {'Code': 80, 'Name': 'stopped'}, Launchtime: 2016-08-25 22:31:31+00:00
|
InstanceID: i-XXXXXXXXXXXXXXX, InstanceType: t2.micro, State: {'Code': 80, 'Name': 'stopped'}, Launchtime: 2016-08-25 22:31:31+00:00
|
||||||
|
python3 weirdAAL.py -m ec2_describe_instances_basic -t demo
|
||||||
'''
|
'''
|
||||||
describe_instances_basic()
|
describe_instances_basic()
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ def module_ec2_describe_instances_basic():
|
|||||||
def module_ec2_describe_instances():
|
def module_ec2_describe_instances():
|
||||||
'''
|
'''
|
||||||
All info about each EC2 instance
|
All info about each EC2 instance
|
||||||
|
python3 weirdAAL.py -m ec2_describe_instances -t demo
|
||||||
'''
|
'''
|
||||||
describe_instances()
|
describe_instances()
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ def module_ec2_describe_instances():
|
|||||||
def module_ec2_write_instances_to_file():
|
def module_ec2_write_instances_to_file():
|
||||||
'''
|
'''
|
||||||
For each region write the instanceIDs to a file by region ex (AWSKEYID-region.txt)
|
For each region write the instanceIDs to a file by region ex (AWSKEYID-region.txt)
|
||||||
|
python3 weirdAAL.py -m ec2_write_instances_to_file -t demo
|
||||||
'''
|
'''
|
||||||
write_instances_to_file()
|
write_instances_to_file()
|
||||||
|
|
||||||
@@ -32,6 +35,7 @@ def module_ec2_write_instances_to_file():
|
|||||||
def module_ec2_get_instance_volume_details():
|
def module_ec2_get_instance_volume_details():
|
||||||
'''
|
'''
|
||||||
Show volumes sorted by instanceId ex: instanceID-->multiple volumes less detail than get_instance_volume_details2
|
Show volumes sorted by instanceId ex: instanceID-->multiple volumes less detail than get_instance_volume_details2
|
||||||
|
python3 weirdAAL.py -m ec2_get_instance_volume_details -t demo
|
||||||
'''
|
'''
|
||||||
get_instance_volume_details()
|
get_instance_volume_details()
|
||||||
|
|
||||||
@@ -39,6 +43,7 @@ def module_ec2_get_instance_volume_details():
|
|||||||
def module_ec2_get_instance_volume_details2():
|
def module_ec2_get_instance_volume_details2():
|
||||||
'''
|
'''
|
||||||
Show volumes by instanceId but instanceID->volume1 of ID, instanceID->volume2 of ID but more details.
|
Show volumes by instanceId but instanceID->volume1 of ID, instanceID->volume2 of ID but more details.
|
||||||
|
python3 weirdAAL.py -m ec2_get_instance_volume_details2 -t demo
|
||||||
'''
|
'''
|
||||||
get_instance_volume_details2()
|
get_instance_volume_details2()
|
||||||
|
|
||||||
@@ -46,6 +51,7 @@ def module_ec2_get_instance_volume_details2():
|
|||||||
def module_ec2_review_encrypted_volumes():
|
def module_ec2_review_encrypted_volumes():
|
||||||
'''
|
'''
|
||||||
This function is used to list EBS volumes and whether or not they are encrypted. This is only for "in-use" (running) volumes.
|
This function is used to list EBS volumes and whether or not they are encrypted. This is only for "in-use" (running) volumes.
|
||||||
|
python3 weirdAAL.py -m ec2_review_encrypted_volumes -t demo
|
||||||
'''
|
'''
|
||||||
review_encrypted_volumes()
|
review_encrypted_volumes()
|
||||||
|
|
||||||
@@ -53,6 +59,7 @@ def module_ec2_review_encrypted_volumes():
|
|||||||
def module_ec2_describe_addresses():
|
def module_ec2_describe_addresses():
|
||||||
'''
|
'''
|
||||||
This function is used to describe ec2 network addresses.
|
This function is used to describe ec2 network addresses.
|
||||||
|
python3 weirdAAL.py -m ec2_describe_addresses -t demo
|
||||||
'''
|
'''
|
||||||
describe_addresses()
|
describe_addresses()
|
||||||
|
|
||||||
@@ -60,6 +67,7 @@ def module_ec2_describe_addresses():
|
|||||||
def module_ec2_describe_network_interfaces():
|
def module_ec2_describe_network_interfaces():
|
||||||
'''
|
'''
|
||||||
This function is used to describe ec2 network interfaces.
|
This function is used to describe ec2 network interfaces.
|
||||||
|
python3 weirdAAL.py -m ec2_describe_network_interfaces -t demo
|
||||||
'''
|
'''
|
||||||
describe_network_interfaces()
|
describe_network_interfaces()
|
||||||
|
|
||||||
@@ -67,6 +75,7 @@ def module_ec2_describe_network_interfaces():
|
|||||||
def module_ec2_describe_route_tables():
|
def module_ec2_describe_route_tables():
|
||||||
'''
|
'''
|
||||||
This function describes route tables for each ec2 instance
|
This function describes route tables for each ec2 instance
|
||||||
|
python3 weirdAAL.py -m ec2_describe_route_tables -t demo
|
||||||
'''
|
'''
|
||||||
describe_route_tables()
|
describe_route_tables()
|
||||||
|
|
||||||
@@ -99,6 +108,7 @@ def module_ec2_get_console_output(*text):
|
|||||||
def module_ec2_get_console_screenshot_all():
|
def module_ec2_get_console_screenshot_all():
|
||||||
'''
|
'''
|
||||||
This function will attempt to screenshot all EC2 instances (loops through all regions)
|
This function will attempt to screenshot all EC2 instances (loops through all regions)
|
||||||
|
python3 weirdAAL.py -m ec2_get_console_screenshot_all -t demo
|
||||||
'''
|
'''
|
||||||
get_console_screenshot_all()
|
get_console_screenshot_all()
|
||||||
|
|
||||||
@@ -106,6 +116,7 @@ def module_ec2_get_console_screenshot_all():
|
|||||||
def module_ec2_get_console_output_all():
|
def module_ec2_get_console_output_all():
|
||||||
'''
|
'''
|
||||||
This function will attempt to get the console output all EC2 instances (loops through all regions)
|
This function will attempt to get the console output all EC2 instances (loops through all regions)
|
||||||
|
python3 weirdAAL.py -m ec2_get_console_output_all -t demo
|
||||||
'''
|
'''
|
||||||
get_console_output_all()
|
get_console_output_all()
|
||||||
|
|
||||||
@@ -153,6 +164,8 @@ def module_ec2_list_launchable_ami():
|
|||||||
per documentation this doenst list AMIs you own.
|
per documentation this doenst list AMIs you own.
|
||||||
"The following command lists the AMIs for which you have explicit launch permissions. This list does not include any AMIs that you own."
|
"The following command lists the AMIs for which you have explicit launch permissions. This list does not include any AMIs that you own."
|
||||||
run ec2_list_owner_ami also to get a list of YOUR account's AMIs
|
run ec2_list_owner_ami also to get a list of YOUR account's AMIs
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m ec2_list_launchable_ami -t demo
|
||||||
'''
|
'''
|
||||||
ec2_list_launchable_ami()
|
ec2_list_launchable_ami()
|
||||||
|
|
||||||
@@ -160,5 +173,6 @@ def module_ec2_list_launchable_ami():
|
|||||||
def module_ec2_list_owner_ami():
|
def module_ec2_list_owner_ami():
|
||||||
'''
|
'''
|
||||||
This function will attempt to get all AMIs for the key owner (loops through all regions)
|
This function will attempt to get all AMIs for the key owner (loops through all regions)
|
||||||
|
python3 weirdAAL.py -m ec2_list_owner_ami -t demo
|
||||||
'''
|
'''
|
||||||
ec2_list_owner_ami()
|
ec2_list_owner_ami()
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
'''
|
'''
|
||||||
ECR functions
|
ECR functions
|
||||||
'''
|
'''
|
||||||
from libs.ecr import *
|
|
||||||
|
from libs.ecr import *
|
||||||
|
|
||||||
|
|
||||||
def module_ecr_describe_repos():
|
def module_ecr_describe_repos():
|
||||||
describe_repositories()
|
'''
|
||||||
|
Describe ECR repositories
|
||||||
|
python3 weirdAAL.py -m ecr_describe_repos -t demo
|
||||||
|
'''
|
||||||
|
ecr_describe_repositories()
|
||||||
|
|||||||
@@ -6,27 +6,54 @@ from libs.elasticbeanstalk import *
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
There is a weird issue that AWS says everyone has elasticbeanstalk permissions
|
There is a weird issue that AWS says everyone has elasticbeanstalk permissions
|
||||||
despite not running any of these services - in other words it wont be abnormal
|
despite not running any of these services - in other words it won't be abnormal
|
||||||
for recon to say it has elasticbeantalk permissions but nothing get returned
|
for recon to say it has elasticbeantalk permissions but nothing gets returned
|
||||||
when you run these functions
|
when you run these functions
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
def module_elasticbeanstalk_describe_applications():
|
def module_elasticbeanstalk_describe_applications():
|
||||||
describe_applications()
|
'''
|
||||||
|
Elasticbeanstalk Describe Applications
|
||||||
|
python3 weirdAAL.py -m elasticbeanstalk_describe_applications -t demo
|
||||||
|
'''
|
||||||
|
elasticbeanstalk_describe_applications()
|
||||||
|
|
||||||
|
|
||||||
def module_elasticbeanstalk_describe_applications_versions():
|
def module_elasticbeanstalk_describe_applications_versions():
|
||||||
describe_application_versions()
|
'''
|
||||||
|
Elasticbeanstalk Describe Application versions
|
||||||
|
python3 weirdAAL.py -m elasticbeanstalk_describe_applications_versions -t demo
|
||||||
|
'''
|
||||||
|
elasticbeanstalk_describe_application_versions()
|
||||||
|
|
||||||
# not working
|
# not working
|
||||||
# def module_elasticbeanstalk_describe_configuration_options():
|
# def module_elasticbeanstalk_describe_configuration_options():
|
||||||
# describe_configuration_options()
|
# elasticbeanstalk_describe_configuration_options()
|
||||||
|
|
||||||
|
|
||||||
def module_elasticbeanstalk_describe_environments():
|
def module_elasticbeanstalk_describe_environments():
|
||||||
describe_environments()
|
'''
|
||||||
|
Elasticbeanstalk Describe Environments
|
||||||
|
python3 weirdAAL.py -m elasticbeanstalk_describe_environments -t demo
|
||||||
|
'''
|
||||||
|
elasticbeanstalk_describe_environments()
|
||||||
|
|
||||||
|
|
||||||
def module_elasticbeanstalk_describe_events():
|
def module_elasticbeanstalk_describe_events():
|
||||||
describe_events()
|
'''
|
||||||
|
Elasticbeanstalk describe events
|
||||||
|
python3 weirdAAL.py -m elasticbeanstalk_describe_events -t demo
|
||||||
|
'''
|
||||||
|
elasticbeanstalk_describe_events()
|
||||||
|
|
||||||
|
|
||||||
|
def module_elasticbeanstalk_check_defaults():
|
||||||
|
'''
|
||||||
|
Test for all 4 of the deault elasticbeanstalk permissions
|
||||||
|
python3 weirdAAL.py -m elasticbeanstalk_check_defaults -t demo
|
||||||
|
'''
|
||||||
|
elasticbeanstalk_describe_applications()
|
||||||
|
elasticbeanstalk_describe_application_versions()
|
||||||
|
elasticbeanstalk_describe_environments()
|
||||||
|
elasticbeanstalk_describe_events()
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
'''
|
'''
|
||||||
This file is used to perform some EMR actions
|
This file is used to perform some EMR actions
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from libs.emr import *
|
from libs.emr import *
|
||||||
|
|
||||||
|
|
||||||
def module_emr_list_clusters():
|
def module_emr_list_clusters():
|
||||||
|
'''
|
||||||
|
EMR List Clusters
|
||||||
|
python3 weirdAAL.py -m emr_list_clusters -t demo
|
||||||
|
'''
|
||||||
list_clusters()
|
list_clusters()
|
||||||
|
|
||||||
|
|
||||||
def module_emr_list_security_configurations():
|
def module_emr_list_security_configurations():
|
||||||
|
'''
|
||||||
|
EMR List Security Configuration
|
||||||
|
python3 weirdAAL.py -m emr_list_security_configurations -t demo
|
||||||
|
'''
|
||||||
list_security_configurations()
|
list_security_configurations()
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
'''
|
'''
|
||||||
Firehose functions
|
Firehose functions
|
||||||
'''
|
'''
|
||||||
from libs.firehose import *
|
from libs.firehose import *
|
||||||
|
|
||||||
|
|
||||||
def module_firehose_list_delivery_streams():
|
def module_firehose_list_delivery_streams():
|
||||||
firehose_list_delivery_streams()
|
'''
|
||||||
|
Firehose list delivery streams
|
||||||
|
python3 weirdAAL.py -m firehose_list_delivery_streams -t demo
|
||||||
|
'''
|
||||||
|
firehose_list_delivery_streams()
|
||||||
|
|
||||||
|
|
||||||
def module_firehose_describe_delivery_streams():
|
def module_firehose_describe_delivery_streams():
|
||||||
firehose_describe_delivery_streams()
|
'''
|
||||||
|
Firehose describe delivery streams
|
||||||
|
python3 weirdAAL.py -m firehose_describe_delivery_streams -t demo
|
||||||
|
'''
|
||||||
|
firehose_describe_delivery_streams()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from libs.iam import *
|
|||||||
def module_iam_list_groups():
|
def module_iam_list_groups():
|
||||||
'''
|
'''
|
||||||
Lists the IAM groups.
|
Lists the IAM groups.
|
||||||
|
python3 weirdAAL.py -m iam_list_groups -t yolo
|
||||||
'''
|
'''
|
||||||
iam_list_groups()
|
iam_list_groups()
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ def module_iam_list_groups():
|
|||||||
def module_iam_get_user():
|
def module_iam_get_user():
|
||||||
'''
|
'''
|
||||||
Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.
|
Retrieves information about the specified IAM user, including the user's creation date, path, unique ID, and ARN.
|
||||||
|
python3 weirdAAL.py -m iam_get_user -t yolo
|
||||||
'''
|
'''
|
||||||
iam_get_user()
|
iam_get_user()
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ def module_iam_get_user():
|
|||||||
def module_iam_get_account_summary():
|
def module_iam_get_account_summary():
|
||||||
'''
|
'''
|
||||||
Retrieves information about IAM entity usage and IAM quotas in the AWS account
|
Retrieves information about IAM entity usage and IAM quotas in the AWS account
|
||||||
|
python3 weirdAAL.py -m iam_get_account_summary -t yolo
|
||||||
'''
|
'''
|
||||||
iam_get_account_summary()
|
iam_get_account_summary()
|
||||||
|
|
||||||
@@ -29,6 +32,7 @@ def module_iam_get_account_summary():
|
|||||||
def module_iam_list_users():
|
def module_iam_list_users():
|
||||||
'''
|
'''
|
||||||
Lists the IAM users that have the specified path prefix. If no path prefix is specified, the operation returns all users in the AWS account. If there are none, the operation returns an empty list.
|
Lists the IAM users that have the specified path prefix. If no path prefix is specified, the operation returns all users in the AWS account. If there are none, the operation returns an empty list.
|
||||||
|
python3 weirdAAL.py -m iam_list_users -t yolo
|
||||||
'''
|
'''
|
||||||
iam_list_users()
|
iam_list_users()
|
||||||
|
|
||||||
@@ -36,6 +40,7 @@ def module_iam_list_users():
|
|||||||
def module_iam_check_root_account():
|
def module_iam_check_root_account():
|
||||||
'''
|
'''
|
||||||
Attempts to call a few IAM functions to see if the account has root or IAM [elevated] permissions
|
Attempts to call a few IAM functions to see if the account has root or IAM [elevated] permissions
|
||||||
|
python3 weirdAAL.py -m iam_check_root_account -t yolo
|
||||||
'''
|
'''
|
||||||
check_root_account()
|
check_root_account()
|
||||||
|
|
||||||
@@ -43,6 +48,7 @@ def module_iam_check_root_account():
|
|||||||
def module_iam_get_password_policy():
|
def module_iam_get_password_policy():
|
||||||
'''
|
'''
|
||||||
Retrieves the password policy for the AWS account.
|
Retrieves the password policy for the AWS account.
|
||||||
|
python3 weirdAAL.py -m iam_get_password_policy -t yolo
|
||||||
'''
|
'''
|
||||||
get_password_policy()
|
get_password_policy()
|
||||||
|
|
||||||
@@ -50,6 +56,7 @@ def module_iam_get_password_policy():
|
|||||||
def module_iam_list_roles():
|
def module_iam_list_roles():
|
||||||
'''
|
'''
|
||||||
Lists the IAM roles that have the specified path prefix. If there are none, the operation returns an empty list.
|
Lists the IAM roles that have the specified path prefix. If there are none, the operation returns an empty list.
|
||||||
|
python3 weirdAAL.py -m iam_list_roles -t yolo
|
||||||
'''
|
'''
|
||||||
iam_list_roles()
|
iam_list_roles()
|
||||||
|
|
||||||
@@ -57,6 +64,7 @@ def module_iam_list_roles():
|
|||||||
def module_iam_list_policies():
|
def module_iam_list_policies():
|
||||||
'''
|
'''
|
||||||
Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.
|
Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.
|
||||||
|
python3 weirdAAL.py -m iam_list_policies -t yolo
|
||||||
'''
|
'''
|
||||||
iam_list_policies()
|
iam_list_policies()
|
||||||
|
|
||||||
@@ -65,6 +73,7 @@ def module_iam_list_policies_attached():
|
|||||||
'''
|
'''
|
||||||
Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.
|
Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.
|
||||||
adds the OnlyAttached=True flag (you probably want to run this one to see what's actually applied to the account)
|
adds the OnlyAttached=True flag (you probably want to run this one to see what's actually applied to the account)
|
||||||
|
python3 weirdAAL.py -m iam_list_policies_attached -t yolo
|
||||||
'''
|
'''
|
||||||
iam_list_policies_attached()
|
iam_list_policies_attached()
|
||||||
|
|
||||||
@@ -95,5 +104,6 @@ def module_iam_list_entities_for_policy(*text):
|
|||||||
def module_iam_get_account_authorization_details():
|
def module_iam_get_account_authorization_details():
|
||||||
'''
|
'''
|
||||||
Retrieves information about all IAM users, groups, roles, and policies in your AWS account, including their relationships to one another. Use this API to obtain a snapshot of the configuration of IAM permissions (users, groups, roles, and policies) in your account.
|
Retrieves information about all IAM users, groups, roles, and policies in your AWS account, including their relationships to one another. Use this API to obtain a snapshot of the configuration of IAM permissions (users, groups, roles, and policies) in your account.
|
||||||
|
python3 weirdAAL.py -m iam_get_account_authorization_details -t yolo
|
||||||
'''
|
'''
|
||||||
get_account_authorization_details()
|
get_account_authorization_details()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'''
|
'''
|
||||||
Functions specifically related to IAM account takeover if you have root or IAM access gather user info,
|
Functions specifically related to IAM account takeover if you have root or IAM access gather user info,
|
||||||
manipulate access keys or passwords, make backdoor account
|
manipulate access keys or passwords, make backdoor account
|
||||||
'''
|
'''
|
||||||
from libs.iam import *
|
from libs.iam import *
|
||||||
@@ -9,6 +9,7 @@ from libs.sts import *
|
|||||||
def module_iam_get_account_summary():
|
def module_iam_get_account_summary():
|
||||||
'''
|
'''
|
||||||
Get account summmary for current user get_account_summary()
|
Get account summmary for current user get_account_summary()
|
||||||
|
python3 weirdAAL.py -m iam_get_account_summary -t yolo
|
||||||
'''
|
'''
|
||||||
iam_get_account_summary()
|
iam_get_account_summary()
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ def module_iam_get_account_summary():
|
|||||||
def module_iam_check_root_account():
|
def module_iam_check_root_account():
|
||||||
'''
|
'''
|
||||||
runs get_account_summary, list_users, for each user list_login_profiles() & list_mfa_devices()
|
runs get_account_summary, list_users, for each user list_login_profiles() & list_mfa_devices()
|
||||||
|
python3 weirdAAL.py -m iam_check_root_account -t yolo
|
||||||
'''
|
'''
|
||||||
check_root_account()
|
check_root_account()
|
||||||
|
|
||||||
@@ -23,6 +25,7 @@ def module_iam_check_root_account():
|
|||||||
def module_iam_get_password_policy():
|
def module_iam_get_password_policy():
|
||||||
'''
|
'''
|
||||||
runs IAM get_account_password_policy for the current user
|
runs IAM get_account_password_policy for the current user
|
||||||
|
python3 weirdAAL.py -m iam_get_password_policy -t yolo
|
||||||
'''
|
'''
|
||||||
get_password_policy()
|
get_password_policy()
|
||||||
|
|
||||||
@@ -70,6 +73,7 @@ def module_iam_delete_access_key(*text):
|
|||||||
def module_iam_create_user(*text):
|
def module_iam_create_user(*text):
|
||||||
'''
|
'''
|
||||||
create a IAM user with the specified username
|
create a IAM user with the specified username
|
||||||
|
python3 weirdAAL.py -m iam_delete_access_key -a 'urpwned' -t yolo
|
||||||
'''
|
'''
|
||||||
iam_create_user(text[0][0])
|
iam_create_user(text[0][0])
|
||||||
|
|
||||||
@@ -77,6 +81,7 @@ def module_iam_create_user(*text):
|
|||||||
def module_iam_make_admin(*text):
|
def module_iam_make_admin(*text):
|
||||||
'''
|
'''
|
||||||
attach the admin policy ['arn:aws:iam::aws:policy/AdministratorAccess'] to the specified user
|
attach the admin policy ['arn:aws:iam::aws:policy/AdministratorAccess'] to the specified user
|
||||||
|
python3 weirdAAL.py -m iam_delete_access_key -a 'urpwned' -t yolo
|
||||||
'''
|
'''
|
||||||
iam_make_admin(text[0][0])
|
iam_make_admin(text[0][0])
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,16 @@ from libs.opsworks import *
|
|||||||
|
|
||||||
|
|
||||||
def module_opsworks_describe_stacks():
|
def module_opsworks_describe_stacks():
|
||||||
|
'''
|
||||||
|
Opsworks Describe stacks
|
||||||
|
python3 weirdAAL.py -m opsworks_describe_stacks -t yolo
|
||||||
|
'''
|
||||||
describe_stacks()
|
describe_stacks()
|
||||||
|
|
||||||
|
|
||||||
def module_opsworks_describe_user_profiles():
|
def module_opsworks_describe_user_profiles():
|
||||||
describe_user_profiles()
|
'''
|
||||||
|
Opsworks describe user profiles
|
||||||
|
python3 weirdAAL.py -m opsworks_describe_user_profiles -t yolo
|
||||||
|
'''
|
||||||
|
describe_user_profiles()
|
||||||
|
|||||||
@@ -8,4 +8,8 @@ from libs.pricing import *
|
|||||||
|
|
||||||
|
|
||||||
def module_pricing_describe_services():
|
def module_pricing_describe_services():
|
||||||
|
'''
|
||||||
|
Pricing describe services
|
||||||
|
python3 weirdAAL.py -m pricing_describe_services -t yolo
|
||||||
|
'''
|
||||||
pricing_describe_services()
|
pricing_describe_services()
|
||||||
|
|||||||
@@ -2,8 +2,12 @@
|
|||||||
RDS module
|
RDS module
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from libs.rds import *
|
from libs.rds import *
|
||||||
|
|
||||||
|
|
||||||
def module_rds_describe_db_instances():
|
def module_rds_describe_db_instances():
|
||||||
describe_db_instances()
|
'''
|
||||||
|
RDS Describe Instances
|
||||||
|
python3 weirdAAL.py -m rds_describe_db_instances -t yolo
|
||||||
|
'''
|
||||||
|
describe_db_instances()
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ from libs.s3 import *
|
|||||||
|
|
||||||
# maps to available services in boto 1.7.4
|
# maps to available services in boto 1.7.4
|
||||||
|
|
||||||
|
|
||||||
def module_recon_all():
|
def module_recon_all():
|
||||||
|
'''
|
||||||
|
Main recon all module - attempt to connect ot each of the services to see if we have some privs
|
||||||
|
python3 weirdAAL.py -m recon_all -t demo
|
||||||
|
'''
|
||||||
get_accountid()
|
get_accountid()
|
||||||
check_root_account()
|
check_root_account()
|
||||||
brute_acm_permissions()
|
brute_acm_permissions()
|
||||||
@@ -148,5 +153,4 @@ def module_recon_all():
|
|||||||
# XRay no functions
|
# XRay no functions
|
||||||
|
|
||||||
# S3 bucket's while we are here...
|
# S3 bucket's while we are here...
|
||||||
#commented out until s3 id/key shit is fixed in all modules/libs
|
|
||||||
get_s3objects_for_account()
|
get_s3objects_for_account()
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
'''
|
'''
|
||||||
route53 functions
|
route53 functions
|
||||||
'''
|
'''
|
||||||
from libs.route53 import *
|
|
||||||
|
from libs.route53 import *
|
||||||
|
|
||||||
|
|
||||||
def module_route53_list_geolocations():
|
def module_route53_list_geolocations():
|
||||||
list_geolocations()
|
'''
|
||||||
|
Route53 list geolocations
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m route53_list_geolocations -t demo
|
||||||
|
'''
|
||||||
|
list_geolocations()
|
||||||
|
|||||||
@@ -2,14 +2,31 @@
|
|||||||
SES module
|
SES module
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from libs.ses import *
|
from libs.ses import *
|
||||||
|
|
||||||
|
|
||||||
def module_ses_list_identities():
|
def module_ses_list_identities():
|
||||||
list_identities()
|
'''
|
||||||
|
SES List identities
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m ses_list_identities -t demo
|
||||||
|
'''
|
||||||
|
list_identities()
|
||||||
|
|
||||||
|
|
||||||
def module_ses_get_send_statistics():
|
def module_ses_get_send_statistics():
|
||||||
get_send_statistics()
|
'''
|
||||||
|
SES get send statistics
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m ses_get_send_statistics -t demo
|
||||||
|
'''
|
||||||
|
get_send_statistics()
|
||||||
|
|
||||||
|
|
||||||
def module_ses_list_configuration_sets():
|
def module_ses_list_configuration_sets():
|
||||||
list_configuration_sets()
|
'''
|
||||||
|
SES list configuration sets
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m ses_list_configuration_sets -t demo
|
||||||
|
'''
|
||||||
|
list_configuration_sets()
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
'''
|
'''
|
||||||
SQS
|
SQS Modules
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from libs.sqs import *
|
from libs.sqs import *
|
||||||
|
|
||||||
|
|
||||||
def module_sqs_list_queues():
|
def module_sqs_list_queues():
|
||||||
sqs_list_queues()
|
'''
|
||||||
|
SQS List Queues
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m sqs_list_queues -t demo
|
||||||
|
'''
|
||||||
|
sqs_list_queues()
|
||||||
|
|||||||
@@ -6,8 +6,18 @@ from libs.sts import *
|
|||||||
|
|
||||||
|
|
||||||
def module_sts_get_accountid():
|
def module_sts_get_accountid():
|
||||||
|
'''
|
||||||
|
STS get account ID - just ID
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m sts_get_accountid -t demo
|
||||||
|
'''
|
||||||
sts_get_accountid()
|
sts_get_accountid()
|
||||||
|
|
||||||
|
|
||||||
def module_sts_get_accountid_all():
|
def module_sts_get_accountid_all():
|
||||||
sts_get_accountid_all()
|
'''
|
||||||
|
STS get as much info as possible - prints AccountID, UserID, ARN
|
||||||
|
|
||||||
|
python3 weirdAAL.py -m sts_get_accountid_all -t demo
|
||||||
|
'''
|
||||||
|
sts_get_accountid_all()
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
Translate module
|
Translate module
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from libs.translate import *
|
from libs.translate import *
|
||||||
|
|
||||||
|
|
||||||
def module_translate_translate_text(*text):
|
def module_translate_translate_text(*text):
|
||||||
'''
|
'''
|
||||||
translate text ==> text, source_language, target_language
|
translate text ==> text, source_language, target_language
|
||||||
'''
|
|
||||||
translate_text(text[0][0], text[0][1], text[0][2])
|
python3 weirdAAL.py -m translate_translate_text -a 'secure your shit','en','fr' -t demo
|
||||||
|
'''
|
||||||
|
translate_text(text[0][0], text[0][1], text[0][2])
|
||||||
|
|||||||
Reference in New Issue
Block a user