From 5bb401a40dac503efaa33e039df6cfa9dc67f48d Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 16:07:38 +0400 Subject: [PATCH 1/8] Fixed bugs that occured from the merge Added feature to allow new line in log's --- CODE/Logicytics.py | 14 ++++---------- CODE/__lib_log.py | 7 +++++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CODE/Logicytics.py b/CODE/Logicytics.py index 6097abb..d37dd7b 100644 --- a/CODE/Logicytics.py +++ b/CODE/Logicytics.py @@ -195,8 +195,7 @@ # Zip generated files if action == "modded": - - zip_loc_mod, hash_loc, deleted_files_zip, deleted_files_hash = zip_and_hash("..\\MODS", "MODS", action) + zip_loc_mod, hash_loc = Zip().and_hash("..\\MODS", "MODS", action) log.info(zip_loc_mod) zip_values = Zip().and_hash("..\\MODS", "MODS", action) if isinstance(zip_values, str): @@ -214,14 +213,6 @@ zip_loc, hash_loc = zip_values log.info(zip_loc) log.debug(hash_loc) - log.debug(deleted_files_zip) - log.debug(deleted_files_hash) - -zip_loc, hash_loc, deleted_files_zip, deleted_files_hash = zip_and_hash("..\\CODE", "CODE", action) -log.info(zip_loc) -log.debug(hash_loc) -log.debug(deleted_files_zip) -log.debug(deleted_files_hash) # Attempt event log deletion attempt_hide() @@ -240,3 +231,6 @@ log.info("Exiting...") input("Press Enter to exit...") +# Special feature that allows to create a `-` line only +log.debug("*-*") +exit(0) diff --git a/CODE/__lib_log.py b/CODE/__lib_log.py index 5a2eda7..eaa769e 100644 --- a/CODE/__lib_log.py +++ b/CODE/__lib_log.py @@ -153,8 +153,11 @@ def debug(self, message): Returns: None """ - if self.level: - colorlog.debug(message) + if message == "*-*": + self.__only("|" + "-" * 19 + "|" + "-" * 13 + "|" + "-" * 152 + "|") + else: + if self.level: + colorlog.debug(message) def info(self, message): """ From 82f9131449d9f10068c6e93971f49c211acff8b1 Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 16:38:48 +0400 Subject: [PATCH 2/8] Fixed bugs that occurred from the merge Added feature to allow new line in log's Also fixed another bug with _dev.py that doesn't allow it to be used due to how its executed --- CODE/Logicytics.py | 11 ++++++----- CODE/__lib_class.py | 11 ++++++++--- CODE/_dev.py | 8 ++++---- CODE/todo | 1 - 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CODE/Logicytics.py b/CODE/Logicytics.py index d37dd7b..b833f5d 100644 --- a/CODE/Logicytics.py +++ b/CODE/Logicytics.py @@ -61,8 +61,10 @@ check_status.sys_internal_zip() if action == "dev": - Execute().execute_script("_dev.py") - input("Press Enter to exit...") + current_dir = os.path.dirname(os.path.abspath(__file__)) + script_path = os.path.join(current_dir, "_dev.py") + process = subprocess.Popen(['cmd.exe', '/c', 'start', 'python', script_path]) + process.wait() exit(0) if action == "extra": @@ -220,10 +222,10 @@ # Finish with sub actions log.info("Completed successfully") if sub_action == "shutdown": - log.info("Shutting down...") + log.info("Shutting down in 3 seconds...") subprocess.call("shutdown /s /t 3", shell=False) if sub_action == "reboot": - log.info("Rebooting...") + log.info("Rebooting in 3 seconds...") subprocess.call("shutdown /r /t 3", shell=False) if sub_action == "webhook": # Implement this in future @@ -233,4 +235,3 @@ input("Press Enter to exit...") # Special feature that allows to create a `-` line only log.debug("*-*") -exit(0) diff --git a/CODE/__lib_class.py b/CODE/__lib_class.py index 8ae39c8..ad7577a 100644 --- a/CODE/__lib_class.py +++ b/CODE/__lib_class.py @@ -13,16 +13,21 @@ class Actions: @staticmethod - def open_file(file: str): + def open_file(file: str, use_full_path= False): """ Opens a specified file using its default application in a cross-platform manner. Args: file (str): The path to the file to be opened. + use_full_path (bool): Whether to use the full path of the file or not. Returns: None """ if not file == "": - file_path = os.path.realpath(file) + if use_full_path: + current_dir = os.path.dirname(os.path.abspath(__file__)) + file_path = os.path.join(current_dir, file) + else: + file_path = os.path.realpath(file) try: subprocess.call(file_path, shell=False) except Exception as e: @@ -348,7 +353,7 @@ def sys_internal_zip(): zip_ref.extractall("SysInternal_Suite") elif ignore_file: - print( + Log(debug=DEBUG).debug( "Found .sys.ignore file, skipping SysInternal_Suite zip extraction" ) diff --git a/CODE/_dev.py b/CODE/_dev.py index 5e4d9d0..45facbf 100644 --- a/CODE/_dev.py +++ b/CODE/_dev.py @@ -42,7 +42,7 @@ def __prompt_user(question: str, file_to_open: str = None) -> bool: answer = input(question + " (yes or no):- ") if answer.lower() != "yes": if file_to_open: - Actions().open_file(file_to_open) + subprocess.run(['start', file_to_open], shell=True) print( "Please ensure you fix the issues/problem and try again with the checklist." ) @@ -134,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/todo b/CODE/todo index 2a38b2d..b49b4e4 100644 --- a/CODE/todo +++ b/CODE/todo @@ -1,3 +1,2 @@ ---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 From 3875da11f2510b1c9b150538f1b68801a2753b8a Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 19:40:55 +0400 Subject: [PATCH 3/8] Updated documentation and fixed obsolete html tags, also removed obselete critical log error codes --- CONTRIBUTING.md | 49 ++++++++---------------------------------------- README.md | 10 +++++----- TESTS/TESTS.md | 22 +++++++++------------- WEB/install.html | 2 +- WEB/styles.css | 4 ---- WEB/wiki2.html | 2 +- WEB/wiki4.html | 2 +- 7 files changed, 25 insertions(+), 66 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 839b45f..b260ce2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,54 +27,28 @@ restrictions: ## Issues assignment I will be looking at the open issues, analyze them, and provide guidance on how to proceed. -Issues can be assigned to anyone other than me** and contributors are welcome + +Issues can be assigned to anyone other than me and contributors are welcome to participate in the discussion and provide their input on how to best solve the issue, and even submit a PR if they want to. + Please wait that the issue is ready to be worked on before submitting a PR. We don't want to waste your time. -Please keep in mind that I am small and have limited resources and am not always able to respond immediately. +Please keep in mind that I am a human and have limited resources and am not always able to respond immediately. I will try to provide feedback as soon as possible, but please be patient. + If you don't get a response immediately, it doesn't mean that we are ignoring you or that we don't care about your issue or PR. We will get back to you as soon as we can. If you decide to pull a PR or fork the project, keep in mind that you should only add/edit the scripts you need to, -leave the Explain.md file and the updating of the structure file to me. +leave core files alone. ## Guidelines for Modifications πŸ“ƒ When making modifications to the Logicytics project, -please adhere to the following guidelines to ensure consistency and maintainability: - -- Use a consistent indentation. -- Add yourself to the [credits](CREDITS.md). -- Make sure you have done all the necessary steps in the [wiki](https://github.com/DefinetlyNotAI/Logicytics/wiki) -- Make sure you have tested your code. - - Keep all tests in the test directory -- Make sure you have followed the instructions in the `--dev` flag. -- Make sure the coding style is similar to previous code -- Code is only written in `python, ps1 or batch` or is an `EXE` file (Highly Unadvised). -- You have not modified or changed the wrapper [`Logicytics.py`](CODE/Logicytics.py) -- All your code follows a strict logging system - - If python, imports the [logger](CODE/__lib_log.py) class and uses it, with adhering to the critical code policy in the [wiki](https://github.com/DefinetlyNotAI/Logicytics/wiki) - - For critical code you adhere to the `FILECODE-ERRORCODE-FUNCTIONCODE` formatting - - If non-python, each print statement starts with either `INFO:` `WARNING:` or `ERROR:` to allow the wrapper to inject the [logger](CODE/__lib_log.py) class. -- Naming the code should follow these conventions: - - File is either a `.py`, `.exe`, `.ps1`, `.bat` file - - If it's a file to be run, shouldn't start with `_` - - If it's a extra file/extra library, to make sure it isn't run, should start with `_` -- No code is allowed to have `if __name__ == '__main__'` or a similar functioning code -- You must start with the following code if using python: - -```python -from __lib_class import * # This imports everything needed including the unique logger called by log - -# Your actual code, must be able to run without any interference by outside actions -# USE log.info, log.error, log.warning and log.debug as well -# You can choose to use any other of the code without issues - -``` +please adhere to the following guidelines on the WiKi page. ## Issues and labels πŸ› οΈ @@ -109,13 +83,6 @@ fits with the scope and aims of the project. It's up to _you_ to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. -## Coding Standards πŸ‘¨β€πŸ’» - -- **Code Style**: Follow the project's existing code style. -- **Commit Messages**: Write clear and descriptive commit messages. Use the imperative mood (e.g., "Add feature" instead - of "Added feature"). -- **Documentation**: Update documentation as necessary to reflect any changes you make. - ## Pull requests πŸ“ Good pull requestsβ€”patches, improvements, new featuresβ€”are a fantastic @@ -155,6 +122,6 @@ You also agree to the [Developer Certificate of Origin](DCO.md). - **Issues**: Use GitHub issues for bug reports and feature requests. Keep the discussion focused and relevant. - **Pull Requests**: Use pull requests to propose changes. Be prepared to discuss your changes and address any feedback. -If you have any questions or need further clarification, please feel free to contact [us](mailto:Nirt_12023@outlook.com) +If you have any questions or need further clarification, please feel free to [contact](mailto:Nirt_12023@outlook.com) me. Thank you for your contributions! diff --git a/README.md b/README.md index d66a8ef..f5f41f7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Crafted with Python 🐍, it's an actively developed project that is dedicated to gathering as much sensitive data as possible and packaging it neatly into a ZIP file πŸ“¦. This comprehensive guide is here to equip you with everything you need to use Logicytics effectively. -
+
GitHub Issues GitHub Tag GitHub Commit Activity @@ -14,11 +14,11 @@ This comprehensive guide is here to equip you with everything you need to use Lo GitHub Branch Check Runs GitHub Repo Size
-
+
GitHub Repo CodeFactor Rating GitHub Repo CodeClimate Rating - OpenSSF Scorecard - + OpenSSF Best Practices Score + OpenSSF Best Practices Badge
## ❀️ Support Me ❀️ @@ -322,7 +322,7 @@ Always obtain proper authorization before extracting any data from a system. ### License - [Developer Certificate of Origin](DCO.md) -- [MIT License](LICENSE.md) +- [MIT License](LICENSE) ### πŸ“ƒ GitHub Actions Status diff --git a/TESTS/TESTS.md b/TESTS/TESTS.md index f5c8b0c..dcb7a5d 100644 --- a/TESTS/TESTS.md +++ b/TESTS/TESTS.md @@ -13,22 +13,18 @@ Here, we follow a specific naming convention to keep things organized and easily - `TEST_database.py` for testing database interactions. - **Test Classes and Methods:** - - **Test Classes:** Should start with `Test_` followed by the name of the class or functionality being tested. For - example: + - **Test Classes:** Should start with `Test_` followed by the name of the class or functionality being tested. + - **Test Methods:** Should be named with the prefix `test_` followed by a descriptive name that indicates what the + test is verifying. + - For example: ```python import unittest - class TestLoginFunctionality(unittest.TestCase): - ... - ``` - - **Test Methods:** Should be named with the prefix `test_` followed by a descriptive name that indicates what the - test is verifying. For example: - ```python - def test_successful_login(self): - ... - - def test_login_with_invalid_credentials(self): - ... + def test_successful_login(self): + ... + + def test_login_with_invalid_credentials(self): + ... ``` Following these conventions helps in quickly identifying and understanding the purpose of each test and makes the diff --git a/WEB/install.html b/WEB/install.html index 8696816..b0d672c 100644 --- a/WEB/install.html +++ b/WEB/install.html @@ -25,7 +25,7 @@

Prerequisites

  • Command Line Knowledge: Basic understanding of command line options is recommended.
  • Step-by-Step Installation

    -
  • Learn the instalation Steps On my Github
  • +
  • Learn the installation Steps On my GitHub
  • Back to Home
    diff --git a/WEB/styles.css b/WEB/styles.css index 5a6d24f..cf8113c 100644 --- a/WEB/styles.css +++ b/WEB/styles.css @@ -274,7 +274,3 @@ .install-link:hover { background-color: #ff6b81; } - -/*By Aban Mahmood Ahmed Github: https://github.com/iamthgeawsomboi2099 */ - - diff --git a/WEB/wiki2.html b/WEB/wiki2.html index 1cc967a..82d0116 100644 --- a/WEB/wiki2.html +++ b/WEB/wiki2.html @@ -33,7 +33,7 @@

    How to Contribute

    Getting Started

    Contributing to open-source projects is a rewarding way to give back to the community while enhancing your skills. Here's how you can get started:

      -
    1. Fork the Repository: Visit the project's GitHub page and click on the 'Fork' button at the top right corner. This creates a copy of the repository in your GitHub account.
    2. +
    3. Fork the Repository: Visit the project's GitHub page and click on the 'Fork' button in the top right corner. This creates a copy of the repository in your GitHub account.
    4. Clone the Repository: Clone the forked repository to your local machine using Git. Open your terminal or command prompt and run:
      git clone https://github.com/DefinetlyNotAI/Logicytics.git
    5. diff --git a/WEB/wiki4.html b/WEB/wiki4.html index 3fa0afc..36f5d1f 100644 --- a/WEB/wiki4.html +++ b/WEB/wiki4.html @@ -40,7 +40,7 @@

      2. Debug Mode

      Debug mode enhances the live feedback mechanism by providing more detailed information during runtime. This involves inspecting variable values at specific points and offering extra insights into the main program to aid developers in understanding how their code is executing. To activate debug mode, set debug to true in the config.json file. This mode is particularly useful when troubleshooting complex issues or when additional context is needed during the program's operation.

      3. Debugger

      -

      The debugger component is a powerful tool for analyzing the state of a program at various points in time. It checks for file integrity, updates, and file structure, ensuring that the codebase is consistent and up-to-date. Additionally, the debugger can analyse the operating system and other external factors that might affect the application's behaviour. Debuggers are essential for diagnosing subtle bugs that are difficult to reproduce consistently. You can run the debugger by using the --debug flag.

      +

      The debugger component is a powerful tool for analyzing the state of a program at various points in time. It checks for file integrity, updates, and file structure, ensuring that the codebase is consistent and up-to-date. Additionally, the debugger can analyze the operating system and other external factors that might affect the application's behaviour. Debuggers are essential for diagnosing subtle bugs that are difficult to reproduce consistently. You can run the debugger by using the --debug flag.

      Back to Home From db2e2da3e842317ce55c7579707f9de526d88c54 Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 19:51:36 +0400 Subject: [PATCH 4/8] Rechanged the logging system AGAIN AAAAAAAAAAAAGHHHHHHHHH Also reformatted code, quick test and checked any warning and errors - also redoc some stuff --- .github/workflows/powershell.yml | 1 + CODE/Logicytics.py | 11 ++----- CODE/__lib_class.py | 26 ++++++--------- CODE/__lib_log.py | 33 +++++++++++++++---- CODE/_debug.py | 17 +++------- CODE/_dev.py | 9 +++--- CODE/_extra.py | 7 ----- CODE/driverquery+sysinfo.py | 7 ----- CODE/log_miner.py | 7 ----- CODE/media_backup.py | 7 ----- CODE/online_ip_scraper.py | 7 ----- CODE/registry.py | 7 ----- CODE/sensitive_data_miner.py | 8 +---- CODE/ssh_miner.py | 7 ----- CODE/sys_internal.py | 8 +---- CODE/tasklist.py | 7 ----- CODE/wifi_stealer.py | 7 ----- CODE/wmic.py | 7 ----- MODS/_MOD_SKELETON.py | 54 +++++++++++++++----------------- WEB/styles.css | 7 ----- 20 files changed, 76 insertions(+), 168 deletions(-) diff --git a/.github/workflows/powershell.yml b/.github/workflows/powershell.yml index 354ab05..8cc11ff 100644 --- a/.github/workflows/powershell.yml +++ b/.github/workflows/powershell.yml @@ -22,6 +22,7 @@ permissions: jobs: build: + # noinspection GrazieInspection permissions: contents: read # for actions/checkout to fetch code security-events: write # for github/codeql-action/upload-sarif to upload SARIF results diff --git a/CODE/Logicytics.py b/CODE/Logicytics.py index b833f5d..98def91 100644 --- a/CODE/Logicytics.py +++ b/CODE/Logicytics.py @@ -7,13 +7,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} """ @@ -63,7 +56,7 @@ if action == "dev": current_dir = os.path.dirname(os.path.abspath(__file__)) script_path = os.path.join(current_dir, "_dev.py") - process = subprocess.Popen(['cmd.exe', '/c', 'start', 'python', script_path]) + process = subprocess.Popen(["cmd.exe", "/c", "start", "python", script_path]) process.wait() exit(0) @@ -116,7 +109,7 @@ # Check for privileges and errors if not check_status.admin(): - log.critical("Please run this script with admin privileges", "_L", "P", "BA") + log.critical("Please run this script with admin privileges") if not DEBUG: input("Press Enter to exit...") exit(1) diff --git a/CODE/__lib_class.py b/CODE/__lib_class.py index ad7577a..3df8243 100644 --- a/CODE/__lib_class.py +++ b/CODE/__lib_class.py @@ -13,7 +13,7 @@ class Actions: @staticmethod - def open_file(file: str, use_full_path= False): + def open_file(file: str, use_full_path=False): """ Opens a specified file using its default application in a cross-platform manner. Args: @@ -425,7 +425,7 @@ def __unblock_ps1_script(script: str): subprocess.run(unblock_command, shell=False, check=True) Log().info("PS1 Script unblocked.") except Exception as err: - Log().critical(f"Failed to unblock script: {err}", "_L", "G", "E") + Log().critical(f"Failed to unblock script: {err}") @staticmethod def __run_python_script(script: str): @@ -450,22 +450,14 @@ def __run_other_script(script: str): Returns: None """ - result = subprocess.Popen( - ["powershell.exe", ".\\" + script], stdout=subprocess.PIPE - ).communicate()[0] - lines = result.decode().splitlines() - ID = next((line.split(":")[0].strip() for line in lines if ":" in line), None) - log_funcs = { - "INFO": Log().info, - "WARNING": Log().warning, - "ERROR": Log().error, - "CRITICAL": Log().critical, - None: Log().debug, - } - - log_func = log_funcs.get(ID, Log().debug) - log_func("\n".join(lines).removeprefix(ID or "")) + result = subprocess.run( + ["powershell.exe", ".\\" + script], capture_output=True, text=True + ) + lines = result.stdout.splitlines() + ID = next((line.split(":")[0].strip() for line in lines if ":" in line), None) + if ID: + Log().string(ID, str(lines)) WEBHOOK, DEBUG, VERSION, API_KEY, CURRENT_FILES = Actions.read_config() diff --git a/CODE/__lib_log.py b/CODE/__lib_log.py index eaa769e..5257e92 100644 --- a/CODE/__lib_log.py +++ b/CODE/__lib_log.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os import pathlib from datetime import datetime @@ -210,15 +212,12 @@ def error(self, message): f"[{self.__timestamp()}] > ERROR: | {self.__pad_message(str(message))}\n" ) - def critical(self, message, FILECODE: str, ERRCODE: str, FUNCODE: str): + def critical(self, message): """ Logs a critical message to the error log File. Args: message: The critical message to be logged. - FILECODE: The File code associated with the critical message. - ERRCODE: The error code associated with the critical message. - FUNCODE: The function code associated with the critical message. Returns: None @@ -226,7 +225,29 @@ def critical(self, message, FILECODE: str, ERRCODE: str, FUNCODE: str): if self.color: colorlog.critical(message) with open(self.err_filename, "a") as f: - code = str(FILECODE) + ":" + str(ERRCODE) + ":" + str(FUNCODE) f.write( - f"[{self.__timestamp()}] > CRITICAL: | {self.__pad_message(str(message) + ' --> ' + code)}\n" + f"[{self.__timestamp()}] > CRITICAL: | {self.__pad_message(str(message))}\n" ) + + def string(self, Type: str, Message: str): + """ + Uses the string given to log the message using the correspondent log type, + defaults to 'log.debug' if no log type is given. + + Args: + Type: The string message to be used to replace XXX in 'log.XXX'. + Message: The message to be logged. + + Returns: + None + """ + log_funcs = { + "INFO": self.info, + "WARNING": self.warning, + "ERROR": self.error, + "DEBUG": self.debug, + None: print, + } + + log_func = log_funcs.get(Type, Log().debug) + log_func("\n".join(Message)) diff --git a/CODE/_debug.py b/CODE/_debug.py index f715ad2..906f6b4 100644 --- a/CODE/_debug.py +++ b/CODE/_debug.py @@ -8,13 +8,6 @@ if __name__ == "__main__": log_debug = Log(debug=DEBUG, filename="../ACCESS/LOGS/DEBUG/DEBUG.LOG") - log_debug_funcs = { - "INFO": log_debug.info, - "WARNING": log_debug.warning, - "ERROR": log_debug.error, - "CRITICAL": log_debug.critical, - None: log_debug.debug, - } class HealthCheck: @@ -199,14 +192,12 @@ 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.string( + version_tuple[2], "\n".join(version_tuple[0]).replace("\n", "") ) + log_debug.string(file_tuple[2], "\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.string(type, "\n".join(message).replace("\n", "")) # Check Admin if Check().admin(): diff --git a/CODE/_dev.py b/CODE/_dev.py index 45facbf..39f0b54 100644 --- a/CODE/_dev.py +++ b/CODE/_dev.py @@ -19,6 +19,7 @@ def __update_json_file(filename: str, new_data: list | str, key: str) -> None: data = json.load(f) data[key] = new_data f.seek(0) + # noinspection PyTypeChecker json.dump(data, f, indent=4) f.truncate() except FileNotFoundError: @@ -42,7 +43,7 @@ def __prompt_user(question: str, file_to_open: str = None) -> bool: answer = input(question + " (yes or no):- ") if answer.lower() != "yes": if file_to_open: - subprocess.run(['start', file_to_open], shell=True) + subprocess.run(["start", file_to_open], shell=True) print( "Please ensure you fix the issues/problem and try again with the checklist." ) @@ -134,9 +135,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 d4fabf5..1538556 100644 --- a/CODE/_extra.py +++ b/CODE/_extra.py @@ -2,13 +2,6 @@ if __name__ == "__main__": log = Log(debug=DEBUG, filename="../ACCESS/LOGS/DEBUG/DEBUG.LOG") - log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, - } def unzip(zip_path: str): diff --git a/CODE/driverquery+sysinfo.py b/CODE/driverquery+sysinfo.py index 09f7ad6..75a7576 100644 --- a/CODE/driverquery+sysinfo.py +++ b/CODE/driverquery+sysinfo.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def command(file: str, com: str, message: str): diff --git a/CODE/log_miner.py b/CODE/log_miner.py index 2c766ee..e0b4a56 100644 --- a/CODE/log_miner.py +++ b/CODE/log_miner.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def backup_windows_logs(): diff --git a/CODE/media_backup.py b/CODE/media_backup.py index d7d91ec..5f5d26c 100644 --- a/CODE/media_backup.py +++ b/CODE/media_backup.py @@ -4,13 +4,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} class Media: diff --git a/CODE/online_ip_scraper.py b/CODE/online_ip_scraper.py index 912fcda..d8c0374 100644 --- a/CODE/online_ip_scraper.py +++ b/CODE/online_ip_scraper.py @@ -4,13 +4,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} class Scrape: diff --git a/CODE/registry.py b/CODE/registry.py index c3f917f..0318dae 100644 --- a/CODE/registry.py +++ b/CODE/registry.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def backup_registry(): diff --git a/CODE/sensitive_data_miner.py b/CODE/sensitive_data_miner.py index 04bb98c..a17ca64 100644 --- a/CODE/sensitive_data_miner.py +++ b/CODE/sensitive_data_miner.py @@ -3,13 +3,7 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} + # List of allowed extensions allowed_extensions = [ diff --git a/CODE/ssh_miner.py b/CODE/ssh_miner.py index 0198a65..9cdacb0 100644 --- a/CODE/ssh_miner.py +++ b/CODE/ssh_miner.py @@ -2,13 +2,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def ssh_miner(): diff --git a/CODE/sys_internal.py b/CODE/sys_internal.py index ddfb3ea..dfcc3a2 100644 --- a/CODE/sys_internal.py +++ b/CODE/sys_internal.py @@ -1,13 +1,7 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} + sys_internal_executables = [ "psfile.exe", diff --git a/CODE/tasklist.py b/CODE/tasklist.py index 613f0f8..d2bffaa 100644 --- a/CODE/tasklist.py +++ b/CODE/tasklist.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def tasklist(): diff --git a/CODE/wifi_stealer.py b/CODE/wifi_stealer.py index 61f5546..f9c3fc1 100644 --- a/CODE/wifi_stealer.py +++ b/CODE/wifi_stealer.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def get_password(ssid: str) -> str or None: diff --git a/CODE/wmic.py b/CODE/wmic.py index 6529700..8394dc4 100644 --- a/CODE/wmic.py +++ b/CODE/wmic.py @@ -1,13 +1,6 @@ from __lib_class import * log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} def wmic(): diff --git a/MODS/_MOD_SKELETON.py b/MODS/_MOD_SKELETON.py index b50eeb3..6a5b000 100644 --- a/MODS/_MOD_SKELETON.py +++ b/MODS/_MOD_SKELETON.py @@ -6,37 +6,35 @@ # This imports everything needed including the unique logger called by log - It is not optional # To know more check the WiKi [Section 2, Coding Rules and Tips, Custom Libraries, __lib_class.py] from __lib_class import * + log = Log(debug=DEBUG) -log_funcs = { - "INFO": log.info, - "WARNING": log.warning, - "ERROR": log.error, - "CRITICAL": log.critical, - None: log.debug, -} # Your actual code, must be able to run without any interference by outside actions # USE log.info, log.error, log.warning and log.debug as well # You can choose to use any other of the code without issues # Example of said code:- -# -# def MOD_EXAMPLE() -> None: -# """ -# This function MOD is used to log different types of messages. -# -# It logs an error message, a warning message, an info message, and a debug message. -# -# Parameters: -# None -# -# Returns: -# None -# """ -# log.error("This is an error") -# log.warning("This is a warning") -# log.info("This is a info message") -# log.debug("This is a debug message") -# pass # Your code here with proper logging -# -# -# MOD_EXAMPLE() + + +def MOD_EXAMPLE() -> None: + """ + This function MOD is used to log different types of messages. + + It logs an error message, a warning message, an info message, and a debug message. + + Parameters: + None + + Returns: + None + """ + log.error("This is an error") + log.warning("This is a warning") + log.info("This is a info message") + log.debug("This is a debug message") + log.critical("This is a critical message") + pass # Your code here with proper logging like the above log options + + +MOD_EXAMPLE() + +# Always remember to call your function at the end of the file and then leave a new line diff --git a/WEB/styles.css b/WEB/styles.css index cf8113c..ef36b05 100644 --- a/WEB/styles.css +++ b/WEB/styles.css @@ -155,13 +155,6 @@ /* About Page Styles */ -.wiki-page { - padding: 40px; - max-width: 800px; - margin: auto; - text-align: left; - color: #333; -} .wiki-page h1 { font-size: 48px; From 9136cf1f0713d756eaf8e50a80a2632e99ff9ac5 Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 20:14:10 +0400 Subject: [PATCH 5/8] Fixed huge bug with the logger It decided to increase duplicate logs double each time its called --- CODE/__lib_class.py | 2 +- CODE/__lib_log.py | 17 ++++++----------- CODE/_debug.py | 10 ++++++---- MODS/_MOD_SKELETON.py | 6 +++++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CODE/__lib_class.py b/CODE/__lib_class.py index 3df8243..8077364 100644 --- a/CODE/__lib_class.py +++ b/CODE/__lib_class.py @@ -457,7 +457,7 @@ def __run_other_script(script: str): lines = result.stdout.splitlines() ID = next((line.split(":")[0].strip() for line in lines if ":" in line), None) if ID: - Log().string(ID, str(lines)) + Log().string(str(lines), ID) WEBHOOK, DEBUG, VERSION, API_KEY, CURRENT_FILES = Actions.read_config() diff --git a/CODE/__lib_log.py b/CODE/__lib_log.py index 5257e92..9a4b8fd 100644 --- a/CODE/__lib_log.py +++ b/CODE/__lib_log.py @@ -229,7 +229,7 @@ def critical(self, message): f"[{self.__timestamp()}] > CRITICAL: | {self.__pad_message(str(message))}\n" ) - def string(self, Type: str, Message: str): + def string(self, Message: str, Type="Debug"): """ Uses the string given to log the message using the correspondent log type, defaults to 'log.debug' if no log type is given. @@ -241,13 +241,8 @@ def string(self, Type: str, Message: str): Returns: None """ - log_funcs = { - "INFO": self.info, - "WARNING": self.warning, - "ERROR": self.error, - "DEBUG": self.debug, - None: print, - } - - log_func = log_funcs.get(Type, Log().debug) - log_func("\n".join(Message)) + try: + getattr(self, Type.lower())(Message) + except AttributeError as AE: + self.warning(f"A wrong Log Type was called: {Type} not found. -> {AE}") + getattr(self, "Debug".lower())(Message) diff --git a/CODE/_debug.py b/CODE/_debug.py index 906f6b4..128ba32 100644 --- a/CODE/_debug.py +++ b/CODE/_debug.py @@ -193,11 +193,11 @@ def debug(): if HealthCheck().get_online_config(): version_tuple, file_tuple = HealthCheck().get_online_config() log_debug.string( - version_tuple[2], "\n".join(version_tuple[0]).replace("\n", "") + "\n".join(version_tuple[0]).replace("\n", ""), version_tuple[2] ) - log_debug.string(file_tuple[2], "\n".join(file_tuple[0]).replace("\n", "")) + log_debug.string("\n".join(file_tuple[0]).replace("\n", ""), file_tuple[2]) message, type = DebugCheck.SysInternal_Binaries("SysInternal_Suite") - log_debug.string(type, "\n".join(message).replace("\n", "")) + log_debug.string("\n".join(message).replace("\n", ""), type) # Check Admin if Check().admin(): @@ -243,4 +243,6 @@ def debug(): log_debug.info(cpuModel) # Get config data - log_debug.info("Debug: " + DEBUG) + log_debug.info(f"Debug: {DEBUG}") + +debug() \ No newline at end of file diff --git a/MODS/_MOD_SKELETON.py b/MODS/_MOD_SKELETON.py index 6a5b000..4dd0aa8 100644 --- a/MODS/_MOD_SKELETON.py +++ b/MODS/_MOD_SKELETON.py @@ -10,7 +10,7 @@ log = Log(debug=DEBUG) # Your actual code, must be able to run without any interference by outside actions -# USE log.info, log.error, log.warning and log.debug as well +# USE log.info, log.error, log.warning and log.debug and log.string as well # You can choose to use any other of the code without issues # Example of said code:- @@ -32,6 +32,10 @@ def MOD_EXAMPLE() -> None: log.info("This is a info message") log.debug("This is a debug message") log.critical("This is a critical message") + # This is special, allows you to use strings to specify the log level, it is not recommended to use this + # Options are error, warning, info, debug, critical - It is case-insensitive and can be used with any of the log levels + # Defaults with the log level of debug + log.string("This is a random message", "ERROR") pass # Your code here with proper logging like the above log options From 321ca80c67c8245392103f5f019684ff40dfe15d Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 20:17:54 +0400 Subject: [PATCH 6/8] Documentation fixes --- CODE/_debug.py | 11 ++++++----- README.md | 27 ++++++--------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/CODE/_debug.py b/CODE/_debug.py index 128ba32..1247cc5 100644 --- a/CODE/_debug.py +++ b/CODE/_debug.py @@ -12,7 +12,7 @@ class HealthCheck: def get_online_config( - self, + 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. @@ -34,7 +34,7 @@ def get_online_config( @staticmethod def __compare_versions( - local_version: str, remote_version: str + 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, @@ -114,11 +114,11 @@ def SysInternal_Binaries(path: str) -> tuple[str, str]: 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 + 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 + file.endswith(".exe") for file in contents ): return "Both zip and exe files - All good", "INFO" else: @@ -245,4 +245,5 @@ def debug(): # Get config data log_debug.info(f"Debug: {DEBUG}") -debug() \ No newline at end of file + +debug() diff --git a/README.md b/README.md index f5f41f7..874e25e 100644 --- a/README.md +++ b/README.md @@ -107,22 +107,19 @@ The config.json file is a JSON file that contains the following information: "WEBHOOK URL": "", "ipgeolocation.io API KEY": "", "DEBUG": true, - "VERSION": "2.0.0", + "VERSION": "X.X.X", "CURRENT_FILES": [ - "browser_miner.ps1", - "driverquery.py", - "log_miner.py", - "media_backup.py", - "netadapter.ps1" + ] } ``` The config.json file is used to store the webhook URL, -the API key for ipgeolocation.io, the DEBUG flag, the VERSION, and the CURRENT_FILES. +the API key for `ipgeolocation.io`, the DEBUG flag, the VERSION, and the CURRENT_FILES. CURRENT_FILES is an array of strings that contains the names of the files you have, this is used to later check for corruption or bugs. +VERSION is the version of the project, used to check and pull for updates. ## πŸš€ Advanced Usage πŸš€ @@ -172,9 +169,8 @@ Some tips are: If those don't work attempt: - Try running the script with powershell instead of cmd, or vice versa -- Try running the script in a different directory -- Try running the script in a different computer -- Try running the script with a different python version above 3.8 +- Try running the script in a different directory, computer or python version above 3.8 + - Note: The version used to develop, test and run the script is 3.11 - Try running the `--debug` flag and check the logs ### Support Resources @@ -183,7 +179,6 @@ Check out the [GitHub wiki](https://github.com/DefinetlyNotAI/Logicytics/wiki) f ## πŸ“Š Data Analysis πŸ“Š - ## Data Extraction Logicytics extracts a wide range of data points on a Windows system. @@ -273,16 +268,6 @@ but it should give you a good idea of what data Logicytics is capable of extract **Any file with `_` is not counted here, do note they may range from custom libraries to special files/wrappers** -### Want More? - -If there is a specific piece of data that you would like to see extracted by Logicytics, -please let us know. We are constantly working to improve the project and adding new features. - -![Extra Tools](IMG/ExtraTools.png "Here is the inbuilt extra tools menu {BETA}") - -Other than mods, some prefixed tools are in the `EXTRA` directory, use the `--extra` flag to traverse these -special tools - ### Want to create your own mod? Check out the [contributing guidlines](CONTRIBUTING.md) file for more info From 995accd6ad990e72789cd2ecb04fc315d03661e3 Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 20:17:54 +0400 Subject: [PATCH 7/8] Documentation fixes --- CODE/_debug.py | 11 ++++++----- CODE/todo | 2 -- README.md | 27 ++++++--------------------- 3 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 CODE/todo diff --git a/CODE/_debug.py b/CODE/_debug.py index 128ba32..1247cc5 100644 --- a/CODE/_debug.py +++ b/CODE/_debug.py @@ -12,7 +12,7 @@ class HealthCheck: def get_online_config( - self, + 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. @@ -34,7 +34,7 @@ def get_online_config( @staticmethod def __compare_versions( - local_version: str, remote_version: str + 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, @@ -114,11 +114,11 @@ def SysInternal_Binaries(path: str) -> tuple[str, str]: 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 + 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 + file.endswith(".exe") for file in contents ): return "Both zip and exe files - All good", "INFO" else: @@ -245,4 +245,5 @@ def debug(): # Get config data log_debug.info(f"Debug: {DEBUG}") -debug() \ No newline at end of file + +debug() diff --git a/CODE/todo b/CODE/todo deleted file mode 100644 index b49b4e4..0000000 --- a/CODE/todo +++ /dev/null @@ -1,2 +0,0 @@ -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 diff --git a/README.md b/README.md index f5f41f7..874e25e 100644 --- a/README.md +++ b/README.md @@ -107,22 +107,19 @@ The config.json file is a JSON file that contains the following information: "WEBHOOK URL": "", "ipgeolocation.io API KEY": "", "DEBUG": true, - "VERSION": "2.0.0", + "VERSION": "X.X.X", "CURRENT_FILES": [ - "browser_miner.ps1", - "driverquery.py", - "log_miner.py", - "media_backup.py", - "netadapter.ps1" + ] } ``` The config.json file is used to store the webhook URL, -the API key for ipgeolocation.io, the DEBUG flag, the VERSION, and the CURRENT_FILES. +the API key for `ipgeolocation.io`, the DEBUG flag, the VERSION, and the CURRENT_FILES. CURRENT_FILES is an array of strings that contains the names of the files you have, this is used to later check for corruption or bugs. +VERSION is the version of the project, used to check and pull for updates. ## πŸš€ Advanced Usage πŸš€ @@ -172,9 +169,8 @@ Some tips are: If those don't work attempt: - Try running the script with powershell instead of cmd, or vice versa -- Try running the script in a different directory -- Try running the script in a different computer -- Try running the script with a different python version above 3.8 +- Try running the script in a different directory, computer or python version above 3.8 + - Note: The version used to develop, test and run the script is 3.11 - Try running the `--debug` flag and check the logs ### Support Resources @@ -183,7 +179,6 @@ Check out the [GitHub wiki](https://github.com/DefinetlyNotAI/Logicytics/wiki) f ## πŸ“Š Data Analysis πŸ“Š - ## Data Extraction Logicytics extracts a wide range of data points on a Windows system. @@ -273,16 +268,6 @@ but it should give you a good idea of what data Logicytics is capable of extract **Any file with `_` is not counted here, do note they may range from custom libraries to special files/wrappers** -### Want More? - -If there is a specific piece of data that you would like to see extracted by Logicytics, -please let us know. We are constantly working to improve the project and adding new features. - -![Extra Tools](IMG/ExtraTools.png "Here is the inbuilt extra tools menu {BETA}") - -Other than mods, some prefixed tools are in the `EXTRA` directory, use the `--extra` flag to traverse these -special tools - ### Want to create your own mod? Check out the [contributing guidlines](CONTRIBUTING.md) file for more info From 23cf37561cfb8c2b2c5dc42d87d0e1c2d1237db4 Mon Sep 17 00:00:00 2001 From: DefinetlyNotAI Date: Sat, 21 Sep 2024 20:29:32 +0400 Subject: [PATCH 8/8] Quick bug fix --- CODE/wifi_stealer.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/CODE/wifi_stealer.py b/CODE/wifi_stealer.py index f9c3fc1..cab739f 100644 --- a/CODE/wifi_stealer.py +++ b/CODE/wifi_stealer.py @@ -3,7 +3,7 @@ log = Log(debug=DEBUG) -def get_password(ssid: str) -> str or None: +def get_password(ssid: str) -> str: """ Retrieves the password associated with a given Wi-Fi SSID. @@ -20,13 +20,19 @@ def get_password(ssid: str) -> str or None: command_output = Actions().run_command( f'netsh wlan show profile name="{ssid}" key=clear' ) + if command_output is None: + return "None" key_content = command_output.splitlines() for line in key_content: if "Key Content" in line: return line.split(":")[1].strip() - return None - except Exception as e: - log.error(e) + return "None" + except UnicodeDecodeError as err: + log.error(err) + return "None" + except Exception as err: + log.error(err) + return "None" def get_wifi_names() -> list: @@ -52,13 +58,16 @@ def get_wifi_names() -> list: wifi_names.append(wifi_name) log.info(f"Retrieved {len(wifi_names)} Wi-Fi names.") return wifi_names - except Exception as e: - log.error(e) + except Exception as err: + log.error(err) with open("WiFi.txt", "w") as file: for name in get_wifi_names(): - log.info(f"Retrieving password for {name.removeprefix(': ')}") - file.write( - f"Name: {name.removeprefix(': ')}, Password: {get_password(name.removeprefix(': '))}\n" - ) + try: + log.info(f"Retrieving password for {name.removeprefix(': ')}") + file.write( + f"Name: {name.removeprefix(': ')}, Password: {get_password(name.removeprefix(': '))}\n" + ) + except Exception as e: + log.error(e)