From cec955c3c8d77f976f4a9bf12baa6bb014da91ed Mon Sep 17 00:00:00 2001 From: cktricky Date: Fri, 14 Sep 2018 11:52:27 -0400 Subject: [PATCH] still futzing around --- libs/utils/common.py | 13 +++++++++---- weirdAAL.py | 8 +++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libs/utils/common.py b/libs/utils/common.py index e7136e6..424f965 100644 --- a/libs/utils/common.py +++ b/libs/utils/common.py @@ -5,8 +5,13 @@ def list_all_files(directory): array = [] - for file in list_of_files: - filename_and_ext = os.path.splitext(file) - if (filename_and_ext[1] == ".py") and not (filename_and_ext[0].startswith("__")): - array.append(filename_and_ext[0]) + path ="modules" + for (dirpath, dirnames, filenames) in os.walk(path): + if ( not (dirpath == os.path.basename(directory)) and + (os.path.isdir(dirpath)) + and not (os.path.basename(dirpath).startswith('__')) ): + if filenames: + list_path_name = dirpath.split('/') + array.append(".".join(list_path_name)) + #array.append(directory.split) return array diff --git a/weirdAAL.py b/weirdAAL.py index f7c8be0..27b827b 100755 --- a/weirdAAL.py +++ b/weirdAAL.py @@ -19,10 +19,11 @@ os.environ['AWS_SHARED_CREDENTIALS_FILE'] = '.env' # If you want to use a transparent + supports SSL proxy you can put it here # os.environ['HTTPS_PROXY'] = 'https://127.0.0.1:3128' -sys.path.append("modules/aws/") -for module in all_modules: - exec("from %s import *" % module) +sys.path.append("modules") +#for module in all_modules: +# exec("from %s import *" % module) +from modules import * parser = argparse.ArgumentParser() parser.add_argument("-m", "--module", help="list the module you would like to run", action="store", type=str, required=True) @@ -56,6 +57,7 @@ def perform_credential_check(): def method_create(): try: + print(globals()) arg = globals()["module_" + args.module] return arg except KeyError: