From dd7fcc455dbed1951be09b09525b0efc40191096 Mon Sep 17 00:00:00 2001 From: Richard Mwewa <74001397+rly0nheart@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:03:15 +0200 Subject: [PATCH] Update Octosuite --- octosuite/main.py | 25 ++++++++++++++++++++++++- octosuite/octosuite.py | 31 ------------------------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/octosuite/main.py b/octosuite/main.py index 45a0361..fe6fea9 100644 --- a/octosuite/main.py +++ b/octosuite/main.py @@ -5,7 +5,30 @@ from octosuite.octosuite import * # I drifted away from the 'pythonic way' here def octosuite(): try: run = Octosuite() - run.on_start() + run.path_finder() + run.clear_screen() + run.configure_logging() + run.check_updates() + xprint(ascii_banner()[1], ascii_banner()[0]) + + """ + Main loop keeps octosuite running, this will break if Octosuite detects a KeyboardInterrupt (Ctrl+C) + or if the 'exit' command is entered. + """ + while True: + xprint(f"{white}┌──({red}{getpass.getuser()}{white}@{red}octosuite{white})\n├──[~{green}{os.getcwd()}{white}]\n└╼ {reset}",end="") + command_input = input().lower() + print("\n") + """ + Iterate over the command_map and check if the user input matches any command in it [command_map], + if there's a match, we return its method. If no match is found, we ignore it. + """ + for command, method in run.command_map: + if command_input == command: + method() + print("\n") + else: + pass except KeyboardInterrupt: logging.warning(ctrl_c) diff --git a/octosuite/octosuite.py b/octosuite/octosuite.py index f8b836f..8b84d2c 100644 --- a/octosuite/octosuite.py +++ b/octosuite/octosuite.py @@ -329,37 +329,6 @@ class Octosuite: pass else: xprint(f"[{green}UPDATE{reset}] A new release of Octosuite is available ({response['tag_name']}). Run 'pip install --upgrade octosuite' to get the updates.\n") - - - """ - on_start() - This is the main method, responsible for mapping commands, calling other methods, and catching exceptions - """ - def on_start(self): - self.path_finder() - self.clear_screen() - self.configure_logging() - self.check_updates() - xprint(ascii_banner()[1], ascii_banner()[0]) - - """ - Main loop keeps octosuite running, this will break if Octosuite detects a KeyboardInterrupt (Ctrl+C) - or if the 'exit' command is entered. - """ - while True: - xprint(f"{white}┌──({red}{getpass.getuser()}{white}@{red}octosuite{white})\n├──[~{green}{os.getcwd()}{white}]\n└╼ {reset}",end="") - command_input = input().lower() - print("\n") - """ - Iterate over the command_map and check if the user input matches any command in it [command_map], - if there's a match, we return its method. If no match is found, we ignore it. - """ - for command, method in self.command_map: - if command_input == command: - method() - print("\n") - else: - pass # Fetching organization info