pep8, elasticbeanstalk fixes
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
'''
|
|
||||||
dynamoDB examples
|
|
||||||
'''
|
|
||||||
from libs.dynamodb import *
|
|
||||||
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
|
||||||
|
|
||||||
list_dynamodb_tables(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
|
||||||
list_dynamodb_tables_detailed(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
|
||||||
@@ -20,7 +20,7 @@ def describe_repositories(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
|
|
||||||
response = client.describe_repositories()
|
response = client.describe_repositories()
|
||||||
|
|
||||||
#print response
|
# 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))
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ ElasticBeanstalk functions
|
|||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
import botocore
|
import botocore
|
||||||
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import sys,os
|
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', ]
|
||||||
|
|
||||||
|
|
||||||
def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
print("### Printing ElasticBeanstalk Applications ###")
|
print("### Printing ElasticBeanstalk Applications ###")
|
||||||
@@ -20,7 +22,7 @@ def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
|
|
||||||
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))
|
||||||
@@ -42,6 +44,7 @@ def describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
print("### Printing ElasticBeanstalk Applications Versions ###")
|
print("### Printing ElasticBeanstalk Applications Versions ###")
|
||||||
try:
|
try:
|
||||||
@@ -50,7 +53,7 @@ def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
|
|
||||||
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))
|
||||||
@@ -72,6 +75,7 @@ def describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
print("### Printing ElasticBeanstalk Configuration Options ###")
|
print("### Printing ElasticBeanstalk Configuration Options ###")
|
||||||
try:
|
try:
|
||||||
@@ -79,8 +83,9 @@ def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
client = boto3.client('elasticbeanstalk', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY, region_name=region)
|
client = boto3.client('elasticbeanstalk', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY, 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))
|
||||||
@@ -88,13 +93,13 @@ def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
print("[-] DescribeConfigurationOptions allowed for {} but no results [-]" .format(region))
|
print("[-] DescribeConfigurationOptions allowed for {} but no results [-]" .format(region))
|
||||||
else:
|
else:
|
||||||
print("### {} ElasticBeanstalk Configuration Options ###" .format(region))
|
print("### {} ElasticBeanstalk Configuration Options ###" .format(region))
|
||||||
#if response['PlatformArn'] is None:
|
# if response['PlatformArn'] is None:
|
||||||
# pass
|
# pass
|
||||||
#else:
|
# else:
|
||||||
# print("PlatformArn: {}" .format(response['PlatformArn']))
|
# print("PlatformArn: {}" .format(response['PlatformArn']))
|
||||||
|
|
||||||
print("SolutionStackName: {}" .format(response['SolutionStackName']))
|
print("SolutionStackName: {}" .format(response['SolutionStackName']))
|
||||||
pp.pprint( "Options: {}" .format(response['Options']))
|
pp.pprint("Options: {}" .format(response['Options']))
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
except botocore.exceptions.ClientError as e:
|
except botocore.exceptions.ClientError as e:
|
||||||
@@ -107,6 +112,7 @@ def describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
print("### Printing ElasticBeanstalk Environments ###")
|
print("### Printing ElasticBeanstalk Environments ###")
|
||||||
try:
|
try:
|
||||||
@@ -115,7 +121,7 @@ def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
|
|
||||||
response = client.describe_environments()
|
response = client.describe_environments()
|
||||||
|
|
||||||
#print response
|
# print response
|
||||||
|
|
||||||
if response.get('Environments') is None:
|
if response.get('Environments') is None:
|
||||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
@@ -137,6 +143,7 @@ def describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
|
||||||
def describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
def describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
print("### Printing ElasticBeanstalk Environments ###")
|
print("### Printing ElasticBeanstalk Environments ###")
|
||||||
try:
|
try:
|
||||||
@@ -145,7 +152,7 @@ def describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
|
|
||||||
response = client.describe_events()
|
response = client.describe_events()
|
||||||
|
|
||||||
#print response
|
# print response
|
||||||
|
|
||||||
if response.get('Events') is None:
|
if response.get('Events') is None:
|
||||||
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
print("{} likely does not have ElasticBeanstalk permissions\n" .format(AWS_ACCESS_KEY_ID))
|
||||||
|
|||||||
9
modules/ecr.py
Normal file
9
modules/ecr.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
'''
|
||||||
|
ECR functions
|
||||||
|
'''
|
||||||
|
from libs.ecr import *
|
||||||
|
|
||||||
|
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
def step_ecr_describe_repos():
|
||||||
|
describe_repositories(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
33
modules/elasticbeanstalk.py
Normal file
33
modules/elasticbeanstalk.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
'''
|
||||||
|
This file is used to perform some ElasticBeanstalk actions
|
||||||
|
'''
|
||||||
|
from libs.elasticbeanstalk import *
|
||||||
|
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
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
|
||||||
|
for recon to say it has elasticbeantalk permissions but nothing get returned
|
||||||
|
when you run these functions
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
def step_elasticbeanstalk_describe_applications():
|
||||||
|
describe_applications(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
|
||||||
|
|
||||||
|
def step_elasticbeanstalk_describe_applications_versions():
|
||||||
|
describe_application_versions(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
|
||||||
|
# not working
|
||||||
|
# def step_elasticbeanstalk_describe_configuration_options():
|
||||||
|
# describe_configuration_options(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
|
||||||
|
|
||||||
|
def step_elasticbeanstalk_describe_environments():
|
||||||
|
describe_environments(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
|
||||||
|
|
||||||
|
def step_elasticbeanstalk_describe_events():
|
||||||
|
describe_events(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
Reference in New Issue
Block a user