diff --git a/CODE/Logicytics.py b/CODE/Logicytics.py index 382d3f0..5d08e68 100644 --- a/CODE/Logicytics.py +++ b/CODE/Logicytics.py @@ -5,6 +5,7 @@ from _hide_my_tracks import attempt_hide from _zipper import Zip from __lib_class import * + log = Log(debug=DEBUG) log_funcs = { "INFO": log.info, @@ -60,7 +61,7 @@ check_status.sys_internal_zip() if action == "dev": - Execute().execute_script("dev.py") + Execute().execute_script("_dev.py") input("Press Enter to exit...") exit(0) diff --git a/CODE/__lib_class.py b/CODE/__lib_class.py index 3b7d976..8ae39c8 100644 --- a/CODE/__lib_class.py +++ b/CODE/__lib_class.py @@ -98,13 +98,13 @@ def __parse_arguments() -> tuple[argparse.Namespace, argparse.ArgumentParser]: "--dev", action="store_true", help="Run Logicytics developer mod, this is only for people who want to register their contributions " - "properly. - Use on your own device only -.", + "properly. - Use on your own device only -.", ) parser.add_argument( "--exe", action="store_true", help="Run Logicytics using its precompiled exe's, These may be outdated and not the best, use only if the " - "device doesnt have python installed.", + "device doesnt have python installed.", ) parser.add_argument( "--debug", @@ -152,7 +152,7 @@ def __exclusivity(args: argparse.Namespace) -> bool: special_flag_used = False if args.reboot or args.shutdown or args.webhook: if not ( - args.default or args.threaded or args.modded or args.minimal or args.exe + args.default or args.threaded or args.modded or args.minimal or args.exe ): print("Invalid combination of flags.") exit(1) @@ -236,11 +236,11 @@ def read_config() -> tuple[str, bool, str, str, list[str]]: files = data.get("CURRENT_FILES", []) if not ( - isinstance(webhook_url, str) - and isinstance(debug, bool) - and isinstance(version, str) - and isinstance(api_key, str) - and isinstance(files, list) + isinstance(webhook_url, str) + and isinstance(debug, bool) + and isinstance(version, str) + and isinstance(api_key, str) + and isinstance(files, list) ): print("Invalid config.json format.") input("Press Enter to exit...") @@ -343,12 +343,14 @@ def sys_internal_zip(): if zip_file and not ignore_file: print("Extracting SysInternal_Suite zip") with zipfile.ZipFile( - "SysInternal_Suite/SysInternal_Suite.zip" + "SysInternal_Suite/SysInternal_Suite.zip" ) as zip_ref: zip_ref.extractall("SysInternal_Suite") elif ignore_file: - print("Found .sys.ignore file, skipping SysInternal_Suite zip extraction") + print( + "Found .sys.ignore file, skipping SysInternal_Suite zip extraction" + ) except Exception as err: print(f"Failed to unzip SysInternal_Suite: {err}", "_L", "G", "CS") @@ -368,9 +370,9 @@ def get_files(directory: str, file_list: list) -> list: """ for filename in os.listdir(directory): if ( - filename.endswith((".py", ".exe", ".ps1", ".bat")) - and not filename.startswith("_") - and filename != "Logicytics.py" + filename.endswith((".py", ".exe", ".ps1", ".bat")) + and not filename.startswith("_") + and filename != "Logicytics.py" ): file_list.append(filename) return file_list diff --git a/CODE/_debug.py b/CODE/_debug.py index 4c261b3..f715ad2 100644 --- a/CODE/_debug.py +++ b/CODE/_debug.py @@ -5,6 +5,7 @@ import psutil import sys from __lib_class import * + if __name__ == "__main__": log_debug = Log(debug=DEBUG, filename="../ACCESS/LOGS/DEBUG/DEBUG.LOG") log_debug_funcs = { @@ -17,7 +18,9 @@ class HealthCheck: - def get_online_config(self) -> bool | tuple[tuple[str, str, str], tuple[str, str, str]]: + def get_online_config( + self, + ) -> bool | tuple[tuple[str, str, str], tuple[str, str, str]]: """ Retrieves configuration data from a remote repository and compares it with the local configuration. @@ -31,13 +34,15 @@ def get_online_config(self) -> bool | tuple[tuple[str, str, str], tuple[str, str except requests.exceptions.ConnectionError: log_debug.warning("No connection found") return False - version_check = self.__compare_versions(VERSION, config['VERSION']) - file_check = self.__check_files(CURRENT_FILES, config['CURRENT_FILES']) + version_check = self.__compare_versions(VERSION, config["VERSION"]) + file_check = self.__check_files(CURRENT_FILES, config["CURRENT_FILES"]) return version_check, file_check @staticmethod - def __compare_versions(local_version: str, remote_version: str) -> tuple[str, str, str]: + def __compare_versions( + local_version: str, remote_version: str + ) -> tuple[str, str, str]: """ Compares the local version with the remote version and returns a tuple containing a comparison result message, a version information message, and a severity level. @@ -52,9 +57,17 @@ def __compare_versions(local_version: str, remote_version: str) -> tuple[str, st if local_version == remote_version: return "Version is up to date.", f"Your Version: {local_version}", "INFO" elif local_version > remote_version: - return "Version is ahead of the repository.", f"Your Version: {local_version}, Repository Version: {remote_version}", "WARNING" + return ( + "Version is ahead of the repository.", + f"Your Version: {local_version}, Repository Version: {remote_version}", + "WARNING", + ) else: - return "Version is behind the repository.", f"Your Version: {local_version}, Repository Version: {remote_version}", "ERROR" + return ( + "Version is behind the repository.", + f"Your Version: {local_version}, Repository Version: {remote_version}", + "ERROR", + ) @staticmethod def __check_files(local_files: list, remote_files: list) -> tuple[str, str, str]: @@ -71,9 +84,17 @@ def __check_files(local_files: list, remote_files: list) -> tuple[str, str, str] """ missing_files = set(remote_files) - set(local_files) if not missing_files: - return "All files are present.", f"Your files: {local_files} contain all the files in the repository.", "INFO" + return ( + "All files are present.", + f"Your files: {local_files} contain all the files in the repository.", + "INFO", + ) else: - return "You have missing files.", f"You are missing the following files: {missing_files}", "ERROR" + return ( + "You have missing files.", + f"You are missing the following files: {missing_files}", + "ERROR", + ) class DebugCheck: @@ -97,16 +118,26 @@ def SysInternal_Binaries(path: str) -> tuple[str, str]: try: contents = os.listdir(path) log_debug.debug(contents) - if any(file.endswith('.ignore') for file in contents): + if any(file.endswith(".ignore") for file in contents): return "A `.sys.ignore` file was found - Ignoring", "WARNING" - if any(file.endswith('.zip') for file in contents) and not any(file.endswith('.exe') for file in contents): + if any(file.endswith(".zip") for file in contents) and not any( + file.endswith(".exe") for file in contents + ): return "Only zip files - Missing EXE's due to no `ignore` file", "ERROR" - elif any(file.endswith('.zip') for file in contents) and any(file.endswith('.exe') for file in contents): + elif any(file.endswith(".zip") for file in contents) and any( + file.endswith(".exe") for file in contents + ): return "Both zip and exe files - All good", "INFO" else: - return "SysInternal Binaries Not Found: Missing Files - Corruption detected", "ERROR" + return ( + "SysInternal Binaries Not Found: Missing Files - Corruption detected", + "ERROR", + ) except FileNotFoundError: - return "SysInternal Binaries Not Found: Missing Directory- Corruption detected", "ERROR" + return ( + "SysInternal Binaries Not Found: Missing Directory- Corruption detected", + "ERROR", + ) except Exception as e: return f"An Unexpected error occurred: {e}", "ERROR" @@ -118,8 +149,12 @@ def execution_policy() -> bool: Returns: bool: True if the execution policy is unrestricted, False otherwise. """ - result = subprocess.run(['powershell', '-Command', 'Get-ExecutionPolicy'], capture_output=True, text=True) - return result.stdout.strip().lower() == 'unrestricted' + result = subprocess.run( + ["powershell", "-Command", "Get-ExecutionPolicy"], + capture_output=True, + text=True, + ) + return result.stdout.strip().lower() == "unrestricted" @staticmethod def cpu_info() -> tuple[str, str, str]: @@ -129,7 +164,11 @@ def cpu_info() -> tuple[str, str, str]: Returns: tuple[str, str, str]: A tuple containing the CPU architecture, vendor ID, and model. """ - return 'CPU Architecture: ' + platform.machine(), 'CPU Vendor Id: ' + platform.system(), 'CPU Model: ' + f"{platform.release()} {platform.version()}" + return ( + "CPU Architecture: " + platform.machine(), + "CPU Vendor Id: " + platform.system(), + "CPU Model: " + f"{platform.release()} {platform.version()}", + ) def debug(): @@ -160,10 +199,14 @@ def debug(): # Check File integrity (Online) if HealthCheck().get_online_config(): version_tuple, file_tuple = HealthCheck().get_online_config() - log_debug_funcs.get(version_tuple[2], log_debug.debug)("\n".join(version_tuple[0]).replace('\n', '')) - log_debug_funcs.get(file_tuple[2], log_debug.debug)("\n".join(file_tuple[0]).replace('\n', '')) + log_debug_funcs.get(version_tuple[2], log_debug.debug)( + "\n".join(version_tuple[0]).replace("\n", "") + ) + log_debug_funcs.get(file_tuple[2], log_debug.debug)( + "\n".join(file_tuple[0]).replace("\n", "") + ) message, type = DebugCheck.SysInternal_Binaries("SysInternal_Suite") - log_debug_funcs.get(type, log_debug.debug)("\n".join(message).replace('\n', '')) + log_debug_funcs.get(type, log_debug.debug)("\n".join(message).replace("\n", "")) # Check Admin if Check().admin(): @@ -195,7 +238,9 @@ def debug(): log_debug.warning("Execution policy is not unrestricted") # Get Python Version - log_debug.info(f"Python Version Used: {sys.version.split()[0]} - Recommended Version is: ~") + log_debug.info( + f"Python Version Used: {sys.version.split()[0]} - Recommended Version is: ~" + ) # Get Repo Path log_debug.info(os.path.abspath(__file__).removesuffix("\\CODE\\_debug.py")) diff --git a/CODE/_dev.py b/CODE/_dev.py index ffa155f..5e4d9d0 100644 --- a/CODE/_dev.py +++ b/CODE/_dev.py @@ -62,7 +62,10 @@ def __dev_checks(self) -> bool: None """ checks = [ - ("Have you read the required contributing guidelines?", "../CONTRIBUTING.md"), + ( + "Have you read the required contributing guidelines?", + "../CONTRIBUTING.md", + ), ("Have you made files you don't want to be run start with '_'?", "."), ("Have you added the file to CODE dir?", "."), ("Have you added docstrings and comments?", "../CONTRIBUTING.md"), @@ -79,8 +82,13 @@ def __dev_checks(self) -> bool: return False remind = False - if self.__prompt_user("Is the update a major or minor upgrade (non-patch update)?"): - if not self.__prompt_user("Did You Build the EXE with Advanced Installer?", "../Logicytics.aip"): + if self.__prompt_user( + "Is the update a major or minor upgrade (non-patch update)?" + ): + if not self.__prompt_user( + "Did You Build the EXE with Advanced Installer?", + "../Logicytics.aip", + ): return False else: remind = True @@ -92,9 +100,13 @@ def __dev_checks(self) -> bool: return False self.__update_json_file("config.json", files, "CURRENT_FILES") - self.__update_json_file("config.json", - input(f"Enter the new version of the project (Old version is {VERSION}):"), - "VERSION") + self.__update_json_file( + "config.json", + input( + f"Enter the new version of the project (Old version is {VERSION}):" + ), + "VERSION", + ) print( "Great Job! Please tick the box in the GitHub PR request for completing steps in --dev" ) @@ -122,9 +134,9 @@ def run_dev(self): test_files = [] for item in os.listdir("../TESTS"): if ( - item.lower().endswith(".py") - and item.lower() != "__init__.py" - and item.lower() != "test.py" + item.lower().endswith(".py") + and item.lower() != "__init__.py" + and item.lower() != "test.py" ): full_path = os.path.abspath(os.path.join("../TESTS", item)) test_files.append(full_path) diff --git a/CODE/_extra.py b/CODE/_extra.py index 91c9f70..d4fabf5 100644 --- a/CODE/_extra.py +++ b/CODE/_extra.py @@ -1,4 +1,5 @@ from __lib_class import * + if __name__ == "__main__": log = Log(debug=DEBUG, filename="../ACCESS/LOGS/DEBUG/DEBUG.LOG") log_funcs = { diff --git a/CODE/_zipper.py b/CODE/_zipper.py index eba27ef..e967d27 100644 --- a/CODE/_zipper.py +++ b/CODE/_zipper.py @@ -47,8 +47,8 @@ def __get_files_to_zip(path: str) -> list: return [ f for f in os.listdir(path) - if not f.endswith((".py", ".exe", ".bat", ".ps1")) and not f.startswith( - ("config.", "SysInternal_Suite", "__pycache__")) + if not f.endswith((".py", ".exe", ".bat", ".ps1")) + and not f.startswith(("config.", "SysInternal_Suite", "__pycache__")) ] @staticmethod diff --git a/CODE/sensitive_data_miner.py b/CODE/sensitive_data_miner.py index a969800..04bb98c 100644 --- a/CODE/sensitive_data_miner.py +++ b/CODE/sensitive_data_miner.py @@ -1,6 +1,7 @@ import shutil from pathlib import Path from __lib_class import * + log = Log(debug=DEBUG) log_funcs = { "INFO": log.info, diff --git a/CODE/sys_internal.py b/CODE/sys_internal.py index 079b25c..ddfb3ea 100644 --- a/CODE/sys_internal.py +++ b/CODE/sys_internal.py @@ -1,4 +1,5 @@ from __lib_class import * + log = Log(debug=DEBUG) log_funcs = { "INFO": log.info, diff --git a/CODE/todo b/CODE/todo index 06a8a3e..2a38b2d 100644 --- a/CODE/todo +++ b/CODE/todo @@ -1,4 +1,3 @@ -black . --dev Then update readme, wiki and contributing guidelines -Finally after all, create a pr, and a release, then the release should contain the commit history etc \ No newline at end of file +Finally after all, create a pr, and a release, then the release should contain the commit history etc \ No newline at end of file diff --git a/CODE/wifi_stealer.py b/CODE/wifi_stealer.py index 94314be..61f5546 100644 --- a/CODE/wifi_stealer.py +++ b/CODE/wifi_stealer.py @@ -1,4 +1,5 @@ from __lib_class import * + log = Log(debug=DEBUG) log_funcs = { "INFO": log.info,