Skip to content

Commit 09c069b

Browse files
Added GitHub Pages Code
1 parent f516510 commit 09c069b

File tree

7 files changed

+134
-8
lines changed

7 files changed

+134
-8
lines changed

CODE/Error_Gen.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ def print_colored(text, color):
2424
color_codes = {
2525
'red': '\033[31m',
2626
'green': '\033[32m',
27+
'yellow': '\033[33m',
2728
}
2829
if color.lower() in color_codes:
2930
print(color_codes[color.lower()] + text + reset)
30-
else:
31-
print("Invalid color name")
3231

3332

3433
def validate_error_id(error_id):
@@ -228,6 +227,7 @@ def list_files_without_error_codes():
228227
_, ext = os.path.splitext(file)
229228
if ext: # Ensure there's a file extension
230229
print(file)
230+
return True
231231
else:
232232
return False
233233

CODE/GUI.py

+93-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import tkinter as tk
22
from tkinter import messagebox
33
import subprocess # Import the subprocess module
4+
import mss
45

56
# Assuming Flags_Library.py contains your flags data, compulsory_flags, and conflicts
67
try:
@@ -9,10 +10,17 @@
910
print("Flags_Library.py not found. Please ensure it exists and contains the necessary data.")
1011
exit(1)
1112

13+
with mss.mss() as sct:
14+
monitors = sct.monitors
15+
for idx, monitor in enumerate(monitors):
16+
test = f"Monitor {idx}: Left={monitor['left']}, Top={monitor['top']}, Width={monitor['width']}, Height={monitor['height']}"
17+
1218
# Initialize the main window
1319
root = tk.Tk()
14-
root.title("Dynamic Command Builder")
15-
root.geometry("400x300")
20+
root.title("⚠️ BETA ⚠️ Dynamic Command Builder ")
21+
result_width = int(monitor['width'] - (monitor['width']/7))
22+
result_height = int(monitor['height'] - (monitor['height']/7))
23+
root.geometry(f"{result_width}x{result_height}")
1624
disabled_buttons = set()
1725

1826
# Variable to hold the command preview
@@ -40,6 +48,10 @@
4048

4149

4250
def reset_and_enable_buttons_except_execute():
51+
"""
52+
Reset the command preview to the default state, validate the command to check for errors,
53+
and enable all buttons except the Execute button.
54+
"""
4355
# Reset the command preview to the default state
4456
command_preview.set("./Logicytics.py")
4557

@@ -54,6 +66,15 @@ def reset_and_enable_buttons_except_execute():
5466

5567
# Function to handle hover events and update the tooltip
5668
def show_tooltip(event):
69+
"""
70+
Shows a tooltip when the mouse hovers over a button.
71+
72+
Parameters:
73+
event (tkinter.Event): The event object that triggered the tooltip display.
74+
75+
Returns:
76+
None
77+
"""
5778
button_text = event.widget.cget("text")
5879
for flag_tuple in flags:
5980
if flag_tuple[0] == button_text:
@@ -76,19 +97,58 @@ def show_tooltip(event):
7697

7798
# Function to handle mouse leave events to hide the tooltip
7899
def hide_tooltip():
100+
"""
101+
Hides the tooltip by clearing the tooltip text and removing the tooltip label from the window.
102+
103+
This function is called when the mouse leaves an element with a tooltip.
104+
It clears the tooltip text by setting it to an empty string using the `config` method of the `tooltip_label` widget.
105+
It then removes the tooltip label from the window by calling the `pack_forget` method.
106+
Finally, it ensures that the tooltip label remains on top of other elements by calling the `lift` method.
107+
108+
Returns:
109+
None
110+
"""
79111
tooltip_label.config(text="")
80112
tooltip_label.pack_forget()
81113
tooltip_label.lift() # Optionally keep it on top even when hidden
82114

83115

84116
def enable_all_buttons():
117+
"""
118+
Enables all the buttons by setting their state to 'normal' and then clears the disabled buttons list.
119+
"""
85120
for btn in disabled_buttons:
86121
btn['state'] = 'normal'
87122
disabled_buttons.clear()
88123

89124

90125
# Function to validate the command and update the error label
91126
def validate_command():
127+
"""
128+
Validates the current command stored in `command_preview` against a set of rules defined by `compulsory_flags`
129+
and `conflicts`.
130+
These rules include checking for the presence of compulsory flags and ensuring there are no conflicting
131+
flag combinations.
132+
If the command fails validation, an appropriate error message is displayed, and the 'Execute' button
133+
is disabled to prevent execution of invalid commands.
134+
If the command passes validation, the error message is cleared,
135+
and the 'Execute' button is enabled, indicating that the command is ready to be executed.
136+
137+
This function operates on global variables:
138+
- `command_preview`: Contains the current command to be validated.
139+
- `compulsory_flags`: A list of flags that must be present in the command for it to be considered valid.
140+
- `conflicts`: A dictionary mapping sets of conflicting flags to error messages.
141+
A command is considered invalid
142+
if it contains both flags in any set of conflicts.
143+
- `error_label`: A Tkinter Label widget used to display error messages.
144+
- `execute_btn`: A Tkinter Button widget controlling the execution of the command.
145+
Its state is toggled based on the
146+
validation result.
147+
148+
Effects:
149+
- Modifies the text of `error_label` to reflect the validation status or error message.
150+
- Toggles the state of `execute_btn` between 'disabled' and 'normal' based on whether the command is valid.
151+
"""
92152
full_command = command_preview.get()
93153
compulsory_flag_count = 0 # Initialize the counter for compulsory flags
94154

@@ -145,6 +205,28 @@ def find_button_by_name(name):
145205

146206
# Modify the append_to_command_preview function to call validate_command immediately after updating the command preview
147207
def append_to_command_preview(button_name):
208+
"""
209+
Appends a button's name to the current command preview and disables the corresponding button.
210+
211+
This function updates the global command preview by appending the specified button's name to it,
212+
effectively simulating the action of pressing the button within the context of the command line interface.
213+
It then locates and disables the button associated with the appended name to prevent duplicate actions.
214+
Finally, it calls the `validate_command()` function to automatically check the validity of the updated command.
215+
216+
Parameters:
217+
- button_name (str): The name of the button to be appended to the command preview and disabled.
218+
219+
Effects:
220+
- Modifies the global `command_preview`
221+
string by appending the new button name and joining the command parts with spaces.
222+
- Updates the state of the button identified by `button_name` to 'disabled',
223+
adding it to the `disabled_buttons` set to track disabled states.
224+
- Calls the `validate_command()` function to ensure the command remains valid after the update.
225+
226+
Note:
227+
This function assumes the existence of global variables `command_preview`,
228+
`find_button_by_name()`, `disabled_buttons`, and `validate_command()`.
229+
"""
148230
current_command = command_preview.get().split()
149231
current_command.append(button_name)
150232
command_preview.set(' '.join(current_command))
@@ -173,6 +255,15 @@ def append_to_command_preview(button_name):
173255

174256
# Function to execute the command in cmd
175257
def execute_command(command_string):
258+
"""
259+
A function that executes a command using powershell.exe based on the given command_string.
260+
261+
Parameters:
262+
command_string (str): The command to be executed.
263+
264+
Returns:
265+
None
266+
"""
176267
try:
177268
command = f'powershell.exe -Command "& {command_string}"'
178269
subprocess.Popen(command, shell=True)

SYSTEM/Logicytics.structure

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
=CODE\Clean.ps1
66
=CODE\CMD_Disabled_Bypass.py
77
=CODE\Copy_Media.py
8+
=CODE\Crash_Reporter.py
89
=CODE\Debugger.py
910
=CODE\Device_Data.bat
10-
=CODE\Error_Catch.py
11+
=CODE\Error_Gen.py
1112
=CODE\Extra_Menu.py
13+
=CODE\Flags_Library.py
14+
=CODE\GUI.py
15+
=CODE\Hash.py
1216
=CODE\IP_Scanner.py
1317
=CODE\Legal.py
1418
=CODE\Logicytics.py
19+
=CODE\Recycle_Logs.py
1520
=CODE\Registry_miner.bat
1621
=CODE\Restore.py
1722
=CODE\Simple_Password_Miner.py
@@ -43,3 +48,5 @@
4348
=CODE\sys\psping.exe
4449
=CODE\sys\PsService.exe
4550
=CODE\sys\pssuspend.exe
51+
=CODE\__pycache__\Flags_Library.cpython-311.pyc
52+
=CODE\__pycache__\Logicytics.cpython-311.pyc

SYSTEM/Logicytics.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.6.0

SYSTEM/error.codes

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ Clean.ps1 = CLN
77
Copy_Media.py = CM
88
Crash_Reporter.py = CR
99
Debugger.py = DB
10+
Dev.py = DEV
1011
Device_Data.bat = DD
1112
Error_Gen.py = EG
1213
Extra_Menu.py = EM
14+
Flags_Library.py = FL
15+
GUI.py = GUI
16+
Hash.py = HSH
1317
IP_Scanner.py = IPS
1418
Legal.py = LGL
1519
Logicytics.py = LCS
20+
Recycle_Logs.py = RL
1621
Registry_miner.bat = RM
1722
Restore.py = RS
1823
SSH_Key_Logger.py = SKL
@@ -28,4 +33,3 @@ Update.py = UD
2833
Window_Defender_Crippler.bat = WDC
2934
Window_Features_Lister.ps1 = WFL
3035
Zipper.py = ZP
31-
Dev.py = DEV

requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ requests~=2.32.3
55
pathlib~=1.0.1
66
PyAutoGUI~=0.9.54
77
uuid~=1.30
8-
WMI~=1.5.1
8+
WMI~=1.5.1
9+
mss~=9.0.1
10+
setuptools~=69.5.1

setup.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from setuptools import setup, find_packages
2+
import os
3+
4+
# Paths to the requirements.txt and Logicytics.version files
5+
requirements_path = 'requirements.txt'
6+
version_path = os.path.join('SYSTEM', 'Logicytics.version')
7+
8+
# Read the version from Logicytics.version
9+
with open(version_path, 'r') as f:
10+
version = f.read().strip()
11+
12+
setup(
13+
name="Logicytics",
14+
version=version, # Dynamically set the version
15+
packages=find_packages(),
16+
install_requires=open(requirements_path).read().splitlines(), # Read requirements.txt
17+
entry_points={
18+
'console_scripts': [
19+
'logicytics=logicytics:logicytics',
20+
],
21+
},
22+
)

0 commit comments

Comments
 (0)