Upload files to "Modules"
This commit is contained in:
50
Modules/cli_handler.py
Normal file
50
Modules/cli_handler.py
Normal file
@ -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 <file> 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 <file>]"
|
||||
)
|
||||
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
|
1
Modules/config.py
Normal file
1
Modules/config.py
Normal file
@ -0,0 +1 @@
|
||||
VERSION = "1.0.3"
|
Reference in New Issue
Block a user