Skip to content

Commit 02f68ce

Browse files
Basic cleanup of the backup removal and major file bug fix
When the init directories for data don't exist, it fails to be made, fixed this by making the first instance create the files (logger module inside the Logicytics module Signed-off-by: Shahm Najeeb <[email protected]>
1 parent 3a3e907 commit 02f68ce

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

CODE/_dev.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import configobj
88

9-
from logicytics import log, get, file_management, CURRENT_FILES, VERSION
9+
from logicytics import log, get, CURRENT_FILES, VERSION
1010

1111

1212
def color_print(text, color="reset", is_input=False) -> None | str:
@@ -190,7 +190,6 @@ def dev_checks() -> None:
190190
- Updates configuration file with current files and version
191191
- Logs warnings or errors during the process
192192
"""
193-
file_management.mkdir()
194193
if not _perform_checks():
195194
return
196195
_handle_file_operations()

CODE/logicytics/FileManagement.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ def open_file(file: str, use_full_path: bool = False) -> str | None:
3535
@staticmethod
3636
def mkdir():
3737
"""
38-
Creates the necessary directories for storing logs, backups, and data.
38+
Creates the necessary directories for storing logs, and data.
3939
4040
This method ensures the existence of specific directory structures used by the application, including:
4141
- Log directories for general, debug, and performance logs
42-
- Backup directory
4342
- Data directories for storing hashes and zip files
4443
4544
The method uses `os.makedirs()` with `exist_ok=True` to create directories without raising an error if they already exist.
@@ -50,7 +49,6 @@ def mkdir():
5049
os.makedirs("../ACCESS/LOGS/", exist_ok=True)
5150
os.makedirs("../ACCESS/LOGS/DEBUG", exist_ok=True)
5251
os.makedirs("../ACCESS/LOGS/PERFORMANCE", exist_ok=True)
53-
os.makedirs("../ACCESS/BACKUP/", exist_ok=True)
5452
os.makedirs("../ACCESS/DATA/Hashes", exist_ok=True)
5553
os.makedirs("../ACCESS/DATA/Zip", exist_ok=True)
5654

CODE/logicytics/Logger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import colorlog
1212

1313
from logicytics.Config import DEBUG
14+
from logicytics.FileManagement import FileManagement
1415

1516

1617
class Log:
@@ -39,6 +40,7 @@ def __init__(self, config: dict = None):
3940
4041
:param config: A dictionary containing configuration options.
4142
"""
43+
FileManagement.mkdir() # Ensure the necessary directories are created
4244
if self._initialized and config is None:
4345
return
4446
self._initialized = True

CODE/logicytics/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
# Check if the script is being run directly, if not, set up the library
1313
if __name__ == '__main__':
1414
exit("This is a library, Please import rather than directly run.")
15-
execute = Execute()
16-
get = Get()
17-
check = Check()
18-
flag = Flag()
19-
file_management = FileManagement()
20-
__show_trace = DEBUG == "DEBUG"
21-
file_management.mkdir()
2215

16+
execute = Execute() # Initialize the Execute class for executing commands
17+
get = Get() # Initialize the Get class for retrieving data
18+
check = Check() # Initialize the Check class for performing checks
19+
flag = Flag() # Initialize the Flag class for managing cli flags
20+
file_management = FileManagement() # Initialize the FileManagement class for file operations
21+
__show_trace = DEBUG == "DEBUG" # Determine if stack traces should be shown based on the debug level
2322

23+
24+
# Exception for handling object loading errors
2425
class ObjectLoadError(Exception):
2526
"""Raised when an Object fails to load."""
2627

@@ -38,6 +39,7 @@ def __init__(self, message="Failed to load object", object_name=None):
3839
super().__init__(message)
3940

4041

42+
# Decorator for marking functions as deprecated [custom]
4143
def deprecated(removal_version: str, reason: str, show_trace: bool = __show_trace) -> callable:
4244
"""
4345
Decorator function that marks a function as deprecated

PLANS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
| Task | Version | Might or Will be done? |
99
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|------------------------|
10-
| Get any BETA features out of BETA | v3.6.0 ||
1110
| Remake VulnScan .pkl and .pth to be more accurate | v3.6.0 ||
1211
| Encrypted Volume Detection and Analysis, Advanced USB Device History Tracker | v3.6.0 ||
1312
| Merge `sensitive data miner` with `vulnscan` to be 1 tool | v4.0.0 ||

0 commit comments

Comments
 (0)