sweeeeet. now i just need the table formatted correctly and we are rockin and rollin
This commit is contained in:
49
weirdAAL.py
49
weirdAAL.py
@@ -13,6 +13,7 @@ from botocore.exceptions import ClientError
|
|||||||
from modules import *
|
from modules import *
|
||||||
import sys
|
import sys
|
||||||
import builtins
|
import builtins
|
||||||
|
import re
|
||||||
|
|
||||||
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = '.env'
|
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = '.env'
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ for module in all_modules:
|
|||||||
exec("from %s import *" % module)
|
exec("from %s import *" % module)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-m", "--module", help="list the module you would like to run", action="store", type=str, required=False)
|
parser.add_argument("-m", "--module", help="list the module you would like to run", action="store", type=str, required=False)
|
||||||
parser.add_argument("-t", "--target", help="Give your target a name so we can track results", action="store", type=str, required=False)
|
parser.add_argument("-t", "--target", help="Give your target a name so we can track results", action="store", type=str, required=False)
|
||||||
@@ -35,6 +37,7 @@ args = parser.parse_args()
|
|||||||
# Provides us with a global var "db_name" we can access anywhere
|
# Provides us with a global var "db_name" we can access anywhere
|
||||||
builtins.db_name = "weirdAAL.db"
|
builtins.db_name = "weirdAAL.db"
|
||||||
|
|
||||||
|
|
||||||
def perform_credential_check():
|
def perform_credential_check():
|
||||||
'''
|
'''
|
||||||
Check that the AWS keys work before we go any further. It picks the keys up from the local .env file
|
Check that the AWS keys work before we go any further. It picks the keys up from the local .env file
|
||||||
@@ -59,6 +62,48 @@ def method_create():
|
|||||||
print("That module does not exist")
|
print("That module does not exist")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
builtins.aws_module_methods_info = {}
|
||||||
|
builtins.gcp_module_methods_info = {}
|
||||||
|
|
||||||
|
def get_methods_for_classname(classname):
|
||||||
|
methods = []
|
||||||
|
all_methods = dir(sys.modules[classname])
|
||||||
|
for meth in all_methods:
|
||||||
|
if meth.startswith("module_"):
|
||||||
|
narg = "{}.__doc__".format(meth)
|
||||||
|
narg = eval(narg)
|
||||||
|
nhash = {}
|
||||||
|
nhash[meth] = narg
|
||||||
|
methods.append(nhash)
|
||||||
|
return methods
|
||||||
|
|
||||||
|
|
||||||
|
def make_list_of_methods(cloud_service, mod):
|
||||||
|
meths = get_methods_for_classname(mod)
|
||||||
|
if cloud_service == 'aws':
|
||||||
|
new_mod_name = re.sub("modules.aws.", "", mod)
|
||||||
|
aws_module_methods_info[new_mod_name.upper()] = meths
|
||||||
|
elif cloud_service == 'gcp':
|
||||||
|
new_mod_name = re.sub("modules.gcp.", "", mod)
|
||||||
|
gcp_module_methods_info[new_mod_name.upper()] = meths
|
||||||
|
|
||||||
|
|
||||||
|
def make_the_list():
|
||||||
|
for m in sys.modules.keys():
|
||||||
|
if (m.startswith("modules.aws")
|
||||||
|
and not (m == "modules.aws")):
|
||||||
|
make_list_of_methods("aws", m)
|
||||||
|
elif ((m.startswith("modules.gcp"))
|
||||||
|
and not (m == "modules.gcp")):
|
||||||
|
make_list_of_methods("gcp", m)
|
||||||
|
|
||||||
|
def print_the_list():
|
||||||
|
print("AWS")
|
||||||
|
print("---")
|
||||||
|
for (k) in aws_module_methods_info:
|
||||||
|
print(k)
|
||||||
|
print(aws_module_methods_info[k])
|
||||||
|
print("....")
|
||||||
|
|
||||||
# Need to figure out if we have keys in the ENV or not
|
# Need to figure out if we have keys in the ENV or not
|
||||||
try:
|
try:
|
||||||
@@ -68,8 +113,8 @@ except:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if (args.list):
|
if (args.list):
|
||||||
for module in all_modules:
|
make_the_list()
|
||||||
print(dir(module))
|
print_the_list()
|
||||||
|
|
||||||
|
|
||||||
# arg_list has to be defined otherwise will cause an exception
|
# arg_list has to be defined otherwise will cause an exception
|
||||||
|
|||||||
Reference in New Issue
Block a user