Files
Hunt-AI/Modules/cli_handler.py

51 lines
1.6 KiB
Python

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