pep8
This commit is contained in:
@@ -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)
|
|
||||||
@@ -103,13 +103,13 @@ def generic_permission_bruteforcer(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ser
|
|||||||
try:
|
try:
|
||||||
insert_reconservice_data(db_name, db_logger)
|
insert_reconservice_data(db_name, db_logger)
|
||||||
except sqlite3.OperationalError as e:
|
except sqlite3.OperationalError as e:
|
||||||
print (e)
|
print(e)
|
||||||
print ("You need to set up the database...exiting")
|
print("You need to set up the database...exiting")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print ("\n")
|
print("\n")
|
||||||
else:
|
else:
|
||||||
print ("\n[-] No {} actions allowed [-]" .format(service))
|
print("\n[-] No {} actions allowed [-]" .format(service))
|
||||||
print ("\n")
|
print("\n")
|
||||||
return actions
|
return actions
|
||||||
|
|
||||||
def generic_method_bruteforcer(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, service, tests):
|
def generic_method_bruteforcer(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, service, tests):
|
||||||
|
|||||||
20
libs/ec2.py
20
libs/ec2.py
@@ -66,7 +66,10 @@ def get_instance_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
pp.pprint(i)
|
pp.pprint(i)
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
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:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
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))
|
print("InstanceID: {}, InstanceType: {}, State: {}, Launchtime: {}".format(instanceid, instancetype, state, launchtime))
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
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:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
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)
|
pp.pprint(volumes)
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
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:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
@@ -132,6 +141,9 @@ def get_instance_volume_details2(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
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:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|||||||
@@ -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 libs.ec2 import *
|
||||||
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
'''
|
||||||
|
Basic info about each instance
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
def step_ec2_get_instances_basic():
|
def step_ec2_get_instances_basic():
|
||||||
get_instance_details_basic(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
get_instance_details_basic(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
All info about each instance
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
def step_ec2_get_instances_detailed():
|
def step_ec2_get_instances_detailed():
|
||||||
get_instance_details(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user