This commit is contained in:
carnal0wnage
2018-04-07 17:28:27 -04:00
parent 2898c11afb
commit 7e78fa821c
4 changed files with 49 additions and 18 deletions

View File

@@ -1,8 +0,0 @@
'''
This file is used to list volumes of ec2 instances
'''
from libs.ec2 import *
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
get_instance_volume_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
get_instance_volume_details2(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

View File

@@ -103,13 +103,13 @@ def generic_permission_bruteforcer(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ser
try:
insert_reconservice_data(db_name, db_logger)
except sqlite3.OperationalError as e:
print (e)
print ("You need to set up the database...exiting")
print(e)
print("You need to set up the database...exiting")
sys.exit()
print ("\n")
print("\n")
else:
print ("\n[-] No {} actions allowed [-]" .format(service))
print ("\n")
print("\n[-] No {} actions allowed [-]" .format(service))
print("\n")
return actions
def generic_method_bruteforcer(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, service, tests):

View File

@@ -66,7 +66,10 @@ def get_instance_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
pp.pprint(i)
except botocore.exceptions.ClientError as e:
print(e)
if e.response['Error']['Code'] == 'UnauthorizedOperation':
print('{} : (UnauthorizedOperation) when calling the DescribeInstances -- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
else:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")
@@ -90,7 +93,10 @@ def get_instance_details_basic(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
print("InstanceID: {}, InstanceType: {}, State: {}, Launchtime: {}".format(instanceid, instancetype, state, launchtime))
except botocore.exceptions.ClientError as e:
print(e)
if e.response['Error']['Code'] == 'UnauthorizedOperation':
print('{} : (UnauthorizedOperation) when calling the DescribeInstances-- sure you have ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
else:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")
@@ -110,7 +116,10 @@ def get_instance_volume_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
pp.pprint(volumes)
except botocore.exceptions.ClientError as e:
print(e)
if e.response['Error']['Code'] == 'UnauthorizedOperation':
print('{} : (UnauthorizedOperation) when calling the DescribeVolumes -- sure you have required ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
else:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")
@@ -132,6 +141,9 @@ def get_instance_volume_details2(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
print("\n")
except botocore.exceptions.ClientError as e:
print(e)
if e.response['Error']['Code'] == 'UnauthorizedOperation':
print('{} : (UnauthorizedOperation) when calling the DescribeVolumes -- sure you have the required ec2 permissions?' .format(AWS_ACCESS_KEY_ID))
else:
print(e)
except KeyboardInterrupt:
print("CTRL-C received, exiting...")

View File

@@ -1,13 +1,40 @@
'''
This file is used to list ec2 instances
This file is used to perform various EC2 operations
'''
from libs.ec2 import *
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
'''
Basic info about each instance
'''
def step_ec2_get_instances_basic():
get_instance_details_basic(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
'''
All info about each instance
'''
def step_ec2_get_instances_detailed():
get_instance_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
'''
show volumes sorted by instanceId ex: instanceID-->multiple volumes less detail than get_instance_volume_details2
'''
def step_ec2_get_instance_volume_details():
get_instance_volume_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
'''
show volumes by instanceId but instanceID->volume1 of ID, instanceID->volume2 of ID but more details.
'''
def step_ec2_get_instance_volume_details2():
get_instance_volume_details2(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)