Skip to content

Commit

Permalink
Added GitHub Pages Code
Browse files Browse the repository at this point in the history
  • Loading branch information
DefinetlyNotAI committed Jun 18, 2024
1 parent f516510 commit 09c069b
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CODE/Error_Gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ def print_colored(text, color):
color_codes = {
'red': '\033[31m',
'green': '\033[32m',
'yellow': '\033[33m',
}
if color.lower() in color_codes:
print(color_codes[color.lower()] + text + reset)
else:
print("Invalid color name")


def validate_error_id(error_id):
Expand Down Expand Up @@ -228,6 +227,7 @@ def list_files_without_error_codes():
_, ext = os.path.splitext(file)
if ext: # Ensure there's a file extension
print(file)
return True
else:
return False

Expand Down
95 changes: 93 additions & 2 deletions CODE/GUI.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tkinter as tk
from tkinter import messagebox
import subprocess # Import the subprocess module
import mss

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

with mss.mss() as sct:
monitors = sct.monitors
for idx, monitor in enumerate(monitors):
test = f"Monitor {idx}: Left={monitor['left']}, Top={monitor['top']}, Width={monitor['width']}, Height={monitor['height']}"

# Initialize the main window
root = tk.Tk()
root.title("Dynamic Command Builder")
root.geometry("400x300")
root.title("⚠️ BETA ⚠️ Dynamic Command Builder ")
result_width = int(monitor['width'] - (monitor['width']/7))
result_height = int(monitor['height'] - (monitor['height']/7))
root.geometry(f"{result_width}x{result_height}")
disabled_buttons = set()

# Variable to hold the command preview
Expand Down Expand Up @@ -40,6 +48,10 @@


def reset_and_enable_buttons_except_execute():
"""
Reset the command preview to the default state, validate the command to check for errors,
and enable all buttons except the Execute button.
"""
# Reset the command preview to the default state
command_preview.set("./Logicytics.py")

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

# Function to handle hover events and update the tooltip
def show_tooltip(event):
"""
Shows a tooltip when the mouse hovers over a button.
Parameters:
event (tkinter.Event): The event object that triggered the tooltip display.
Returns:
None
"""
button_text = event.widget.cget("text")
for flag_tuple in flags:
if flag_tuple[0] == button_text:
Expand All @@ -76,19 +97,58 @@ def show_tooltip(event):

# Function to handle mouse leave events to hide the tooltip
def hide_tooltip():
"""
Hides the tooltip by clearing the tooltip text and removing the tooltip label from the window.
This function is called when the mouse leaves an element with a tooltip.
It clears the tooltip text by setting it to an empty string using the `config` method of the `tooltip_label` widget.
It then removes the tooltip label from the window by calling the `pack_forget` method.
Finally, it ensures that the tooltip label remains on top of other elements by calling the `lift` method.
Returns:
None
"""
tooltip_label.config(text="")
tooltip_label.pack_forget()
tooltip_label.lift() # Optionally keep it on top even when hidden


def enable_all_buttons():
"""
Enables all the buttons by setting their state to 'normal' and then clears the disabled buttons list.
"""
for btn in disabled_buttons:
btn['state'] = 'normal'
disabled_buttons.clear()


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

Expand Down Expand Up @@ -145,6 +205,28 @@ def find_button_by_name(name):

# Modify the append_to_command_preview function to call validate_command immediately after updating the command preview
def append_to_command_preview(button_name):
"""
Appends a button's name to the current command preview and disables the corresponding button.
This function updates the global command preview by appending the specified button's name to it,
effectively simulating the action of pressing the button within the context of the command line interface.
It then locates and disables the button associated with the appended name to prevent duplicate actions.
Finally, it calls the `validate_command()` function to automatically check the validity of the updated command.
Parameters:
- button_name (str): The name of the button to be appended to the command preview and disabled.
Effects:
- Modifies the global `command_preview`
string by appending the new button name and joining the command parts with spaces.
- Updates the state of the button identified by `button_name` to 'disabled',
adding it to the `disabled_buttons` set to track disabled states.
- Calls the `validate_command()` function to ensure the command remains valid after the update.
Note:
This function assumes the existence of global variables `command_preview`,
`find_button_by_name()`, `disabled_buttons`, and `validate_command()`.
"""
current_command = command_preview.get().split()
current_command.append(button_name)
command_preview.set(' '.join(current_command))
Expand Down Expand Up @@ -173,6 +255,15 @@ def append_to_command_preview(button_name):

# Function to execute the command in cmd
def execute_command(command_string):
"""
A function that executes a command using powershell.exe based on the given command_string.
Parameters:
command_string (str): The command to be executed.
Returns:
None
"""
try:
command = f'powershell.exe -Command "& {command_string}"'
subprocess.Popen(command, shell=True)
Expand Down
9 changes: 8 additions & 1 deletion SYSTEM/Logicytics.structure
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
=CODE\Clean.ps1
=CODE\CMD_Disabled_Bypass.py
=CODE\Copy_Media.py
=CODE\Crash_Reporter.py
=CODE\Debugger.py
=CODE\Device_Data.bat
=CODE\Error_Catch.py
=CODE\Error_Gen.py
=CODE\Extra_Menu.py
=CODE\Flags_Library.py
=CODE\GUI.py
=CODE\Hash.py
=CODE\IP_Scanner.py
=CODE\Legal.py
=CODE\Logicytics.py
=CODE\Recycle_Logs.py
=CODE\Registry_miner.bat
=CODE\Restore.py
=CODE\Simple_Password_Miner.py
Expand Down Expand Up @@ -43,3 +48,5 @@
=CODE\sys\psping.exe
=CODE\sys\PsService.exe
=CODE\sys\pssuspend.exe
=CODE\__pycache__\Flags_Library.cpython-311.pyc
=CODE\__pycache__\Logicytics.cpython-311.pyc
2 changes: 1 addition & 1 deletion SYSTEM/Logicytics.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.0
1.6.0
6 changes: 5 additions & 1 deletion SYSTEM/error.codes
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ Clean.ps1 = CLN
Copy_Media.py = CM
Crash_Reporter.py = CR
Debugger.py = DB
Dev.py = DEV
Device_Data.bat = DD
Error_Gen.py = EG
Extra_Menu.py = EM
Flags_Library.py = FL
GUI.py = GUI
Hash.py = HSH
IP_Scanner.py = IPS
Legal.py = LGL
Logicytics.py = LCS
Recycle_Logs.py = RL
Registry_miner.bat = RM
Restore.py = RS
SSH_Key_Logger.py = SKL
Expand All @@ -28,4 +33,3 @@ Update.py = UD
Window_Defender_Crippler.bat = WDC
Window_Features_Lister.ps1 = WFL
Zipper.py = ZP
Dev.py = DEV
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ requests~=2.32.3
pathlib~=1.0.1
PyAutoGUI~=0.9.54
uuid~=1.30
WMI~=1.5.1
WMI~=1.5.1
mss~=9.0.1
setuptools~=69.5.1
22 changes: 22 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from setuptools import setup, find_packages
import os

# Paths to the requirements.txt and Logicytics.version files
requirements_path = 'requirements.txt'
version_path = os.path.join('SYSTEM', 'Logicytics.version')

# Read the version from Logicytics.version
with open(version_path, 'r') as f:
version = f.read().strip()

setup(
name="Logicytics",
version=version, # Dynamically set the version
packages=find_packages(),
install_requires=open(requirements_path).read().splitlines(), # Read requirements.txt
entry_points={
'console_scripts': [
'logicytics=logicytics:logicytics',
],
},
)

0 comments on commit 09c069b

Please sign in to comment.