• XSS.stack #1 – первый литературный журнал от юзеров форума

[HELP] Creating a GUI - Combo Tool

BlackedOut

ripper
КИДАЛА
Регистрация
11.09.2023
Сообщения
342
Реакции
122
Пожалуйста, обратите внимание, что пользователь заблокирован
So i have been working on this Combo Text tool for working with USERNAME:PASSWORD strings and URL:USER:PASSWORD strings.

I am wanting to use the QT Creator software to develop the interface but I have the python code and .ui file - that is required.



У вас должно быть более 100 сообщений для просмотра скрытого контента.

Python:
import tkinter as tk
from tkinter import ttk
from tkinter import simpledialog
import re
import os
import string
from tkinter import filedialog
import webbrowser
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton

root = tk.Tk()
version = "1.7"
root.title(f"CashCombos Pro by @Cash_Out_Gang1337 - Version {version}")
root.geometry("1130x600")
root.resizable(True, True) # Allow both horizontal and vertical resizing
root.configure(bg="#333")
menu_bar = tk.Menu(root)
root.config(menu=menu_bar)

style = ttk.Style(root)
style.configure(
    "TFrame", background="#333"
)
style.configure(
    "TLabel", background="#333", foreground="#ddd"
)
style.configure(
    "TButton", background="#555", foreground="black"
)
style.configure(
    "TText", background="#444", foreground="#ddd", insertbackground='white'
)

main_frame = ttk.Frame(root)
main_frame.pack(padx=5, pady=5, fill=tk.BOTH, expand=True)

input_label = ttk.Label(main_frame, text="Input:")
input_label.grid(row=0, column=0, sticky=tk.W, pady=3)

output_label = ttk.Label(main_frame, text="Output:")
output_label.grid(row=2, column=0, sticky=tk.W, pady=3)


input_text = tk.Text(main_frame, wrap=tk.WORD, height=10)
input_text.grid(row=1, column=0, pady=3, sticky=tk.EW)
input_text.bind("<KeyRelease>", lambda e: update_line_count())

output_text = tk.Text(main_frame, wrap=tk.WORD, height=10)
output_text.grid(row=3, column=0, pady=3, sticky=tk.EW)

input_lines = tk.StringVar()
input_lines_label = ttk.Label(main_frame, textvariable=input_lines)
input_lines_label.grid(row=0, column=0, sticky=tk.W, pady=3)

output_lines = tk.StringVar()
output_lines_label = ttk.Label(main_frame, textvariable=output_lines)
output_lines_label.grid(row=2, column=0, sticky=tk.W, pady=3)

def menu_callback():
    print("Menu option selected")

def load_file_path():
    folder_path = filedialog.askdirectory()
    if folder_path:
        input_text.delete(1.0, tk.END)
        input_text.insert(tk.END, folder_path)
        update_line_count()


def submenu_callback():
    print("Submenu option selected")
    
def load_text():
    file_path = filedialog.askopenfilename(filetypes=[("Text Files", "*.txt")])
    if file_path:
        with open(file_path, "r") as file:
            content = file.read()
            input_text.delete(1.0, tk.END)
            input_text.insert(tk.END, content)
            update_line_count()
            
results_path_checkbox_var = tk.BooleanVar()
results_path_checkbox_var.set(False)

def set_results_path():
    if results_path_checkbox_var.get():
        folder_path = filedialog.askdirectory()
        if folder_path:
            results_path = os.path.join(folder_path, "results.txt")
            with open(results_path, "w") as file:
                file.write(output_text.get(1.0, tk.END))
    else:
        results_path_checkbox_var.set(0)

option1_menu = tk.Menu(menu_bar)
menu_bar.add_cascade(label="Main Menu", menu=option1_menu)

file_management_submenu = tk.Menu(option1_menu)
option1_menu.add_cascade(label="File Management", menu=file_management_submenu)

file_management_submenu.add_command(label="Load Text", command=load_text)
file_management_submenu.add_command(label="Load File Path", command=load_file_path)
file_management_submenu.add_checkbutton(label="Set Results Path", variable=results_path_checkbox_var, command=set_results_path)


def set_results_path():
    if results_path_checkbox_var.get():
        folder_path = filedialog.askdirectory()
        if folder_path:
            results_path = os.path.join(folder_path, "results.txt")
            with open(results_path, "w") as file:
                file.write(output_text.get(1.0, tk.END))
    else:
        results_path_checkbox_var.set(0)
    
# Create the second option with its sub-options
option2_menu = tk.Menu(menu_bar)
menu_bar.add_cascade(label="Shop", menu=option2_menu)
for i in range(1, 2):
    option2_menu.add_command(label=f"About Shop", command=submenu_callback)

# Create the third option with its sub-options
option3_menu = tk.Menu(menu_bar)
menu_bar.add_cascade(label="Marketplace", menu=option3_menu)
for i in range(1, 5):
    option3_menu.add_command(label=f"Sub Option {i}", command=submenu_callback)
    
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.web_view = QWebEngineView(self)
        self.setCentralWidget(self.web_view)

        self.about_callback()

    def about_callback():
        app = QApplication(sys.argv)
        main_window = MainWindow()
        main_window.more_info_callback()
        main_window.resize(root.winfo_width() // 2, root.winfo_height() // 2)  # Set initial size to half of the main interface
        app.exec_()
        root.destroy()

        
def about_callback():
    webbrowser.open("https://example.com/about")
    
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.web_view = QWebEngineView(self)
        self.setCentralWidget(self.web_view)

        self.report_callback()

    def report_callback(self):
        self.web_view.load(QUrl("https://example.com/about"))
        self.resize(root.winfo_width() // 2, root.winfo_height() // 2)  # Set initial size to half of the main interface
        self.show()
        
def report_callback():
    webbrowser.open("https://example.com/report")
    

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.web_view = QWebEngineView(self)
        self.setCentralWidget(self.web_view)

        self.community_callback()

    def community_callback(self):
        self.web_view.load(QUrl("https://example.com/about"))
        self.resize(root.winfo_width() // 2, root.winfo_height() // 2)  # Set initial size to half of the main interface
        self.show()


def community_callback():
    app = QApplication(sys.argv)
    main_window = MainWindow()
    sys.exit(app.exec_())


def community_callback():
    webbrowser.open("https://example.com/community")
    
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.web_view = QWebEngineView(self)
        self.setCentralWidget(self.web_view)

        self.more_info_callback()

    def more_info_callback(self):
        self.web_view.load(QUrl("https://example.com/about"))
        self.resize(root.winfo_width() // 2, root.winfo_height() // 2)  # Set initial size to half of the main interface
        self.show()

def about_callback():
    app = QApplication(sys.argv)
    main_window = MainWindow()
    sys.exit(app.exec_())

option4_menu = tk.Menu(menu_bar)
menu_bar.add_cascade(label="Information", menu=option4_menu)
option4_menu.add_command(label="About", command=about_callback)
option4_menu.add_command(label="Report", command=submenu_callback)
option4_menu.add_command(label="Community", command=submenu_callback)
option4_menu.add_command(label="More Info", command=about_callback)




def paste_to_input():
    """Paste content from clipboard to input_text widget."""
    try:
        clipboard_content = root.clipboard_get()
        input_text.delete(1.0, tk.END)
        input_text.insert(tk.END, clipboard_content)
        update_line_count()
    except tk.TclError:
        pass



def copy_from_output():
    """Copy content from output_text widget to clipboard."""
    output_content = output_text.get(1.0, tk.END)
    root.clipboard_clear()
    root.clipboard_append(output_content)
    
def remove_duplicates():
    """Remove duplicate lines from input and display in output."""
    lines = input_text.get(1.0, tk.END).splitlines()
    unique_lines = list(dict.fromkeys(lines))
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, "\n".join(unique_lines))
    update_line_count()
    
def extract_by_search():
    """Function to extract lines by a search term and save to file."""
    search_term = simpledialog.askstring("Search", "Enter the term to search for:")
    
    if search_term:
        matched_lines = [line for line in input_text.get(1.0, tk.END).splitlines() if search_term.lower() in line.lower()]


        with open(f"{search_term}.txt", "a", encoding="utf-8") as file:  # "a" mode appends to the file
            for line in matched_lines:
                file.write(line + '\n')

        with open(f"{search_term}.txt", "r", encoding="utf-8") as file:
            lines = file.readlines()
            cleaned_lines = list(dict.fromkeys(lines))

        with open(f"{search_term}.txt", "w", encoding="utf-8") as file:
            file.writelines(cleaned_lines)
        
        output_text.delete(1.0, tk.END)
        output_text.insert(tk.END, ''.join(cleaned_lines))
        update_line_count()

        
def extract_32_chars_after_colon():
    """Extract lines where the content after the colon is exactly 32 characters and save to file."""
    pattern = re.compile(r":.{32}$")
    matched_lines = [line for line in input_text.get(1.0, tk.END).splitlines() if pattern.search(line)]


    with open("_Extracted_MD5_.txt", "a", encoding="utf-8") as file:  # "a" mode appends to the file
        for line in matched_lines:
            file.write(line + '\n')

    with open("_Extracted_MD5_.txt", "r", encoding="utf-8") as file:
        lines = file.readlines()
        cleaned_lines = list(dict.fromkeys(lines))

    with open("_Extracted_MD5_.txt", "w", encoding="utf-8") as file:
        file.writelines(cleaned_lines)
        
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, ''.join(cleaned_lines))
    update_line_count()

    
def show_domain_statistics():
    """Display domain statistics in the output_text widget in descending order."""
    lines = input_text.get(1.0, tk.END).splitlines()

    # Count the number of lines with "Saved Path:"
    saved_path_lines = sum(1 for line in lines if line.strip().lower() == "saved path:")

    domains = [re.search(r"@(.+?)\.", line, re.IGNORECASE) for line in lines]
    domain_list = [match.group(1).lower() for match in domains if match]  # Convert to lowercase

    domain_stats = {}
    total = len(domain_list)
    for domain in domain_list:
        if domain not in domain_stats:
            domain_stats[domain] = 0
        domain_stats[domain] += 1

    sorted_stats = sorted(domain_stats.items(), key=lambda x: x[1], reverse=True)
    
    stats_output = []
    
    if saved_path_lines > 0:
        stats_output.append(f"Saved Path: {saved_path_lines}")
        if results_path_checkbox_var.get():
            stats_output.append(f"Saved Path Directory: {results_path_checkbox_var.get()}")

    for domain, count in sorted_stats:
        percentage = (count / total) * 100
        stats_output.append(f"{count} {domain} Lines ({percentage:.2f}%)")

    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, '\n'.join(stats_output))
    update_line_count()


def filter_colon_lines():
    """Keep only lines containing a colon and with 5 to 28 characters after the colon."""
    lines = input_text.get(1.0, tk.END).splitlines()
    filtered_lines = []
    
    for line in lines:
        if ":" in line:
            _, _, after_colon = line.partition(":")
            after_length = len(after_colon.strip())
            if 5 <= after_length <= 28:
                filtered_lines.append(line)
    
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, '\n'.join(filtered_lines))
    update_line_count()

def remove_after_space():
    """Remove content after the first space in each line."""
    lines = input_text.get(1.0, tk.END).splitlines()
    processed_lines = [line.split(" ")[0] for line in lines]
    
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, '\n'.join(processed_lines))
    update_line_count()

import random
from tkinter import simpledialog

def organize_lines():
    """Provide multiple sorting options and sort lines based on user's choice."""
    options = ["A-Z", "Z-A", "0-9", "Shortest to longest", "Longest to shortest", "Randomize lines"]
    choice = simpledialog.askstring("Organize", "Choose an option number:\n1. A-Z\n2. Z-A\n3. 0-9\n4. Short to long\n5. Long to short\n6. Randomize Lines", initialvalue="A-Z", parent=root)

    lines = input_text.get(1.0, tk.END).splitlines()
    if choice == "1":
        sorted_lines = sorted(lines)
    elif choice == "2":
        sorted_lines = sorted(lines, reverse=True)
    elif choice == "3":
        sorted_lines = sorted(lines, key=lambda x: [int(t) if t.isdigit() else t for t in re.split('(\d+)', x)])
    elif choice == "4":
        sorted_lines = sorted(lines, key=len)
    elif choice == "5":
        sorted_lines = sorted(lines, key=len, reverse=True)
    elif choice == "6":
        random.shuffle(lines)
        sorted_lines = lines
    else:
        return

    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, '\n'.join(sorted_lines))
    update_line_count()

def split_by_lines():
    """Split content based on user-defined number of lines and save to a specified directory."""
    num_lines = simpledialog.askinteger("Split", "How many lines for each split?", parent=root)
    if not num_lines:
        return
    
    split_name = simpledialog.askstring("Name", "What to name the split?", parent=root)
    if not split_name:
        return

    directory = os.path.join("split", split_name)
    if not os.path.exists(directory):
        os.makedirs(directory)
    
    lines = input_text.get(1.0, tk.END).splitlines()
    for index, start_line in enumerate(range(0, len(lines), num_lines), 1):
        file_path = os.path.join(directory, f"{split_name}_{index}.txt")
        with open(file_path, "w", encoding="utf-8") as file:
            file.write('\n'.join(lines[start_line:start_line + num_lines]))

def combine_files():
    """Combine all text files from 'toCombine' directory, save to '_combined_.txt' and remove duplicates."""
    combined_content = []
    dir_path = "toCombine"

    for filename in os.listdir(dir_path):
        if filename.endswith(".txt"):
            with open(os.path.join(dir_path, filename), "r", encoding="utf-8") as file:
                combined_content.extend(file.readlines())

    with open("_combined_.txt", "w", encoding="utf-8") as file:
        file.writelines(combined_content)

    with open("_combined_.txt", "r", encoding="utf-8") as file:
        lines = file.readlines()
        unique_lines = list(dict.fromkeys(lines))

    with open("_combined_.txt", "w", encoding="utf-8") as file:
        file.writelines(unique_lines)

    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, ''.join(unique_lines))
    update_line_count()
    
def save_output():
    """Save the content of output_text to a file named after user's input."""
    filename = simpledialog.askstring("Save As", "Enter the name for the file:", parent=root)
    
    if not filename:
        return

    if not filename.endswith(".txt"):
        filename += ".txt"

    with open(filename, "w", encoding="utf-8") as file:
        file.write(output_text.get(1.0, tk.END))


def remove_after_special_character():
    special_character = simpledialog.askstring("Special Character", "Enter the special character:")
    
    if special_character:
        lines = input_text.get(1.0, tk.END).splitlines()
        processed_lines = []

        for line in lines:
            if special_character in line:
                line = line.split(special_character)[0]
            processed_lines.append(line)
        
        output_text.delete(1.0, tk.END)
        output_text.insert(tk.END, '\n'.join(processed_lines))
        update_line_count()

def update_output():

    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, input_text.get(1.0, tk.END))
    update_line_count()

def update_line_count():
    input_lines.set(f"Input Lines: {len(input_text.get(1.0, tk.END).splitlines())}")
    output_lines.set(f"Output Lines: {len(output_text.get(1.0, tk.END).splitlines())}")

def remove_links():
    input_text_content = input_text.get(1.0, tk.END)
    remove_option_value = remove_option.get()

    if remove_option_value == "prefix":
        removed_links_content = re.sub(r'http[s]?://\S+', '', input_text_content)
    elif remove_option_value == "subdomains":
        removed_links_content = re.sub(r'http[s]?://(?:www\.)?([^/?]+).*', r'\1', input_text_content)
    else:
        removed_links_content = input_text_content

    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, removed_links_content)
    
def remove_ending_punctuation():
    lines = input_text.get(1.0, tk.END).splitlines()
    processed_lines = []

    for line in lines:
        if line and line[-1] in string.punctuation:
            line = line[:-1]
        processed_lines.append(line)
    
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, '\n'.join(processed_lines))
    update_line_count()
    
def switch_to_cookie_mode():
    cookie_window = tk.Toplevel(root)
    cookie_window.title("Cookie Mode")
    cookie_window.geometry(f"{root.winfo_width()}x{root.winfo_height()}")
    cookie_window.configure(bg="black")

    style = ttk.Style(cookie_window)
    style.configure("TLabel", foreground="green", background="black", font=("Courier", 12))
    style.configure("TButton", foreground="green", background="black", font=("Courier", 12))

    start_btn = ttk.Button(cookie_window, text="Start", command=start)
    start_btn.pack(side=tk.LEFT, padx=0, pady=10)

    stop_btn = ttk.Button(cookie_window, text="Stop", command=stop)
    stop_btn.pack(side=tk.LEFT, padx=0, pady=10)

    pause_btn = ttk.Button(cookie_window, text="Pause", command=pause)
    pause_btn.pack(side=tk.LEFT, padx=0, pady=10)
    
    switch_back_btn = ttk.Button(cookie_window, text="Switch Back to Combo Mode", command=cookie_window.destroy)
    switch_back_btn.place(relx=1, rely=1, anchor="se", x=-10, y=-10)
    
def load_logs():
    # Add your logic for loading logs here
    print("Loading Logs")

def start():
    # Add your logic for starting here
    print("Starting")

def stop():
    # Add your logic for stopping here
    print("Stopping")

def pause():
    # Add your logic for pausing here
    print("Pausing")

def reverse_order():
    input_data = input_text.get(1.0, tk.END).strip()
    lines = input_data.split("\n")
    reversed_lines = [":".join(reversed(line.split(":"))) for line in lines]
    reversed_data = "\n".join(reversed_lines)
    output_text.delete(1.0, tk.END)
    output_text.insert(tk.END, reversed_data)
    

statistics_frame = ttk.LabelFrame(main_frame, text="Statistics")
statistics_frame.grid(row=1, column=2, rowspan=3, padx=30, pady=50, sticky=tk.NSEW)

reverse_btn = ttk.Button(root, text="REVERSE ORDER", command=reverse_order)
reverse_btn.place(relx=0.5, rely=0.1, anchor="center")

total_lines_label = ttk.Label(statistics_frame, text="Total Lines:")
total_lines_label.grid(row=0, column=0, sticky=tk.W, padx=5, pady=5)

lines_left_label = ttk.Label(statistics_frame, text="Lines Left:")
lines_left_label.grid(row=1, column=0, sticky=tk.W, padx=5, pady=5)

lines_completed_label = ttk.Label(statistics_frame, text="Lines Completed:")
lines_completed_label.grid(row=2, column=0, sticky=tk.W, padx=5, pady=5)

total_lines_value = tk.StringVar()
total_lines_value_label = ttk.Label(statistics_frame, textvariable=total_lines_value)
total_lines_value_label.grid(row=0, column=1, sticky=tk.W, padx=5, pady=5)

lines_left_value = tk.StringVar()
lines_left_value_label = ttk.Label(statistics_frame, textvariable=lines_left_value)
lines_left_value_label.grid(row=1, column=1, sticky=tk.W, padx=5, pady=5)

lines_completed_value = tk.StringVar()
lines_completed_value_label = ttk.Label(statistics_frame, textvariable=lines_completed_value)
lines_completed_value_label.grid(row=2, column=1, sticky=tk.W, padx=5, pady=5)

switch_cookie_btn = ttk.Button(root, text="Open Cookie Text Tool", command=switch_to_cookie_mode)
switch_cookie_btn.place(relx=1, rely=1, anchor="se", x=-10, y=-10)

button_frame = ttk.Frame(main_frame)
button_frame.grid(row=4, column=0, pady=10, sticky=tk.EW)

# First row of buttons
paste_btn = ttk.Button(button_frame, text="Paste Input", command=paste_to_input)
paste_btn.grid(row=0, column=0, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

copy_btn = ttk.Button(button_frame, text="Copy Output", command=copy_from_output)
copy_btn.grid(row=0, column=1, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

remove_dup_btn = ttk.Button(button_frame, text="Remove Duplicates", command=remove_duplicates)
remove_dup_btn.grid(row=0, column=2, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

extract_search_btn = ttk.Button(button_frame, text="Extract Domain", command=extract_by_search)
extract_search_btn.grid(row=0, column=3, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

extract_32chars_btn = ttk.Button(button_frame, text="Extract MD5", command=extract_32_chars_after_colon)
extract_32chars_btn.grid(row=0, column=4, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

remove_special_char_btn = ttk.Button(button_frame, text="Remove after Special Character", command=remove_after_special_character)
remove_special_char_btn.grid(row=0, column=5, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

# Second row of buttons
domain_stats_btn = ttk.Button(button_frame, text="Statistics", command=show_domain_statistics)
domain_stats_btn.grid(row=1, column=0, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

filter_colon_btn = ttk.Button(button_frame, text="Cleanup", command=filter_colon_lines)
filter_colon_btn.grid(row=1, column=1, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

remove_capture_btn = ttk.Button(button_frame, text="Remove capture", command=remove_after_space)
remove_capture_btn.grid(row=1, column=2, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

organize_btn = ttk.Button(button_frame, text="Organize", command=organize_lines)
organize_btn.grid(row=1, column=3, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

split_btn = ttk.Button(button_frame, text="Split", command=split_by_lines)
split_btn.grid(row=1, column=4, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

combine_btn = ttk.Button(button_frame, text="Combine", command=combine_files)
combine_btn.grid(row=1, column=5, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

save_output_btn = ttk.Button(button_frame, text="Save Output", command=save_output)
save_output_btn.grid(row=1, column=6, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

remove_links_btn = ttk.Button(button_frame, text="Remove Links", command=remove_links)
remove_links_btn.grid(row=0, column=6, padx=5)

remove_ending_punctuation_btn = ttk.Button(button_frame, text="Remove Ending Punctuation", command=remove_ending_punctuation)
remove_ending_punctuation_btn.grid(row=2, column=0, padx=5, sticky=tk.E + tk.W)  # Center the button horizontally

remove_option = tk.StringVar()
remove_option.set("")  # Empty initial value

remove_combo = ttk.Combobox(button_frame, textvariable=remove_option, values=["", "Remove Prefix", "Remove Subdomains"])
remove_combo.grid(row=1, column=6, padx=5)
update_line_count()

root.mainloop()



IF YOU HAVE EXPERIANCE WITH QT CREATOR, and this message is restricted, please send me a personal message to help.
 
Пожалуйста, обратите внимание, что пользователь заблокирован
Пожалуйста, обратите внимание, что пользователь заблокирован
So i have been working on this Combo Text tool for working with USERNAME:PASSWORD strings and URL:USER:PASSWORD strings.

I am wanting to use the QT Creator software to develop the interface but I have the python code and .ui file - that is required.



Hidden content


IF YOU HAVE EXPERIANCE WITH QT CREATOR, and this message is restricted, please send me a personal message to help.
Спасибо, что поделился
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх