From 55c2f96ba8d38c54901f16f21d8b88ea099059e1 Mon Sep 17 00:00:00 2001 From: Matthew Iverson Date: Tue, 26 Nov 2024 08:05:34 -0500 Subject: [PATCH] Upload files to "Modules" --- Modules/cli_handler.py | 50 ++++++++++++++++++++++++++++++++++++++++++ Modules/config.py | 1 + 2 files changed, 51 insertions(+) create mode 100644 Modules/cli_handler.py create mode 100644 Modules/config.py diff --git a/Modules/cli_handler.py b/Modules/cli_handler.py new file mode 100644 index 0000000..daf42b4 --- /dev/null +++ b/Modules/cli_handler.py @@ -0,0 +1,50 @@ +import argparse +from TTPs.menu import MENU_OPTIONS as BASE_MENU_OPTIONS +from Modules.Imports.all_imports import * +from Modules.config import * + +def display_help(): + help_text = """ +Usage: + python3 dco.py Start the program + python3 dco.py -v Display the current version + python3 dco.py -h Show this help page + python3 dco.py -f Add the last session so users can collaborate + """ + print(help_text) + +def get_version(): + """Display the version of the application.""" + print(f"DCO Version: {VERSION}") + +def load_session(file_path): + """Load a session file.""" + try: + with open(file_path, "r") as file: + session_data = file.read() + print(f"Session loaded successfully from {file_path}") + print(session_data) # Optionally display the session data + except FileNotFoundError: + print(f"Error: File {file_path} not found.") + except Exception as e: + print(f"Error: {e}") + +def handle_arguments(): + """Parse and handle command-line arguments.""" + parser = argparse.ArgumentParser( + description="DCO - Threat AI Command Interface", + usage="python3 dco.py [-v | -f ]" + ) + parser.add_argument("-v", "--version", action="store_true", help="Display the current version") + parser.add_argument("-f", "--file", type=str, help="Add the last session file for collaboration") + + # Parse the arguments + args = parser.parse_args() + + # Handle arguments + if args.version: + get_version() + exit(0) # Exit after displaying the version + elif args.file: + load_session(args.file) + exit(0) # Exit after loading the session diff --git a/Modules/config.py b/Modules/config.py new file mode 100644 index 0000000..0784efa --- /dev/null +++ b/Modules/config.py @@ -0,0 +1 @@ +VERSION = "1.0.3" \ No newline at end of file