@@ -75,10 +75,16 @@ def update() -> tuple[str, str]:
7575
7676def get_flags ():
7777 """
78- Retrieves the action and sub-action flags_list from the Flag module and logs them.
79-
80- This function sets the global variables ACTION and SUB_ACTION based on the data
81- retrieved from the Flag module. It also logs the retrieved values for debugging purposes.
78+ Retrieves action and sub-action flags from the Flag module and sets global variables.
79+
80+ This function extracts the current action and sub-action from the Flag module, setting global
81+ ACTION and SUB_ACTION variables. It logs the retrieved values for debugging and tracing purposes.
82+
83+ No parameters.
84+
85+ Side effects:
86+ - Sets global variables ACTION and SUB_ACTION
87+ - Logs debug information about current action and sub-action
8288 """
8389 global ACTION , SUB_ACTION
8490 # Get flags_list
@@ -89,10 +95,22 @@ def get_flags():
8995
9096def special_execute (file_path : str ):
9197 """
92- Executes a Python script in a new command prompt window.
93-
94- Args:
95- file_path (str): The relative path to the Python script to be executed.
98+ Execute a Python script in a new command prompt window.
99+
100+ This function launches the specified Python script in a separate command prompt window, waits for its completion, and then exits the current process.
101+
102+ Parameters:
103+ file_path (str): The relative path to the Python script to be executed,
104+ which will be resolved relative to the current script's directory.
105+
106+ Side Effects:
107+ - Opens a new command prompt window
108+ - Runs the specified Python script
109+ - Terminates the current process after script execution
110+
111+ Raises:
112+ FileNotFoundError: If the specified script path does not exist
113+ subprocess.SubprocessError: If there are issues launching the subprocess
96114 """
97115 sr_current_dir = os .path .dirname (os .path .abspath (__file__ ))
98116 sr_script_path = os .path .join (sr_current_dir , file_path )
@@ -103,12 +121,23 @@ def special_execute(file_path: str):
103121
104122def handle_special_actions ():
105123 """
106- Handles special actions based on the provided action flag.
107-
108- This function checks the value of the `action` variable and performs
109- corresponding special actions such as opening debug, developer, or extra
110- tools menus, updating the repository, restoring backups, creating backups,
111- or unzipping extra files.
124+ Handles special actions based on the current action flag.
125+
126+ This function performs specific actions depending on the global `ACTION` variable:
127+ - For "debug": Opens the debug menu by executing '_debug.py'
128+ - For "dev": Opens the developer menu by executing '_dev.py'
129+ - For "update": Updates the repository using Health.update() method
130+ - For "restore": Displays a warning and opens the backup location
131+ - For "backup": Creates backups of the CODE and MODS directories
132+
133+ Side Effects:
134+ - Logs informational, debug, warning, or error messages
135+ - May execute external Python scripts
136+ - May open file locations
137+ - May terminate the program after completing special actions
138+
139+ Raises:
140+ SystemExit: Exits the program after completing certain special actions
112141 """
113142 # Special actions -> Quit
114143 if ACTION == "debug" :
@@ -158,10 +187,18 @@ def handle_special_actions():
158187def check_privileges ():
159188 """
160189 Checks if the script is running with administrative privileges and handles UAC (User Account Control) settings.
161-
190+
162191 This function verifies if the script has admin privileges. If not, it either logs a warning (in debug mode) or
163192 prompts the user to run the script with admin privileges and exits. It also checks if UAC is enabled and logs
164193 warnings accordingly.
194+
195+ Raises:
196+ SystemExit: If the script is not running with admin privileges and not in debug mode.
197+
198+ Notes:
199+ - Requires the `Check` module with `admin()` and `uac()` methods
200+ - Depends on global `DEBUG` configuration variable
201+ - Logs warnings or critical messages based on privilege and UAC status
165202 """
166203 if not Check .admin ():
167204 if DEBUG == "DEBUG" :
@@ -178,10 +215,29 @@ def check_privileges():
178215
179216def generate_execution_list () -> list | list [str ] | list [str | Any ]:
180217 """
181- Creates an execution list based on the provided action.
182-
218+ Generate an execution list of scripts based on the specified action.
219+
220+ This function dynamically creates a list of scripts to be executed by filtering and selecting
221+ scripts based on the global ACTION variable. It supports different execution modes:
222+ - 'minimal': A predefined set of lightweight scripts
223+ - 'nopy': PowerShell and script-based scripts without Python
224+ - 'modded': Includes scripts from the MODS directory
225+ - 'depth': Comprehensive script execution with data mining and logging scripts
226+ - 'vulnscan_ai': Vulnerability scanning script only
227+
228+ Parameters:
229+ None
230+
183231 Returns:
184- list: The execution list of scripts to be executed.
232+ list[str]: A list of script file paths to be executed, filtered and modified based on the current action.
233+
234+ Raises:
235+ ValueError: Implicitly if a script file cannot be removed from the initial list.
236+
237+ Notes:
238+ - Removes sensitive or unnecessary scripts from the initial file list
239+ - Logs the final execution list for debugging purposes
240+ - Warns users about potential long execution times for certain actions
185241 """
186242 execution_list = Get .list_of_files ("." , extensions = (".py" , ".exe" , ".ps1" , ".bat" ))
187243 execution_list .remove ("sensitive_data_miner.py" )
@@ -345,16 +401,18 @@ def handle_sub_action():
345401@log .function
346402def Logicytics ():
347403 """
348- Main function to run the Logicytics process.
349-
350- This function performs the following steps:
351- 1. Retrieves command-line flags_list and configurations.
352- 2. Handles any special actions based on the provided action flag.
353- 3. Checks for administrative privileges and potential errors.
354- 4. Executes the scripts based on the action flag.
355- 5. Zips the generated files.
356- 6. Handles any sub-actions based on the provided sub-action flag.
357- 7. Waits for user input to exit the program.
404+ Orchestrates the complete Logicytics workflow, managing script execution, system actions, and user interactions.
405+
406+ This function serves as the primary entry point for the Logicytics utility, coordinating a series of system-level operations:
407+ - Retrieves command-line configuration flags
408+ - Processes special actions
409+ - Verifies system privileges
410+ - Executes targeted scripts
411+ - Compresses generated output files
412+ - Handles final system sub-actions
413+ - Provides a graceful exit mechanism
414+
415+ Performs actions sequentially without returning a value, designed to be the main execution flow of the Logicytics utility.
358416 """
359417 # Get flags_list and configs
360418 get_flags ()
0 commit comments