Files
PSecuritySuite/PSecuritySuite-A-1-ii.py
2026-04-21 20:37:36 -04:00

205 lines
7.3 KiB
Python

import random
import secrets
import string
import sys
# ----- CREDITS ----- #
# By P7MJ and only P7MJ. SpyDrone and OctoLinkYT are allowed to make a GUI for this and improve upon it.
# Perfect for secure activities, or anywhere else where you need to:
# - Generate random accounts
# - Overwrite messages and LLM prompts with random junk
# ----- VERSION ----- #
# Version A-1-ii "DWeb", the first version to integrate darkweb_register.py and prompt_destroyer.py into
# one integrated file, built upon and taking its name from the former. You can find these two files in
# the "archive" folder this script is located in.
# Patch 1-ii: Small fixes
# ----- SPECIAL STUFF ----- #
# I decided to take a modular approach to this project. Everything is clearly marked, configurable, and modular.
# What you cannot change in the config, you can easily change in this script.
# Also this script contains a lot of commenting shi at the front which this is part of.
# ----- CONFIG MANIPULATION AND FETCHING ----- #
def get_config_value(key, filename="config.txt"):
with open(filename, "r") as f:
# Finds the first line starting with the key, splits it, and converts to int
return int(next(line for line in f if line.startswith(key)).split(": ")[1].strip())
def set_config_value(key, value, filename="config.txt"):
try:
with open(filename, "r") as f:
lines = f.readlines()
except FileNotFoundError:
lines = []
new_line = f"{key}: {value}\n"
found = False
# Rebuild the list of lines, replacing the key if found
for i, line in enumerate(lines):
if line.startswith(f"{key}:"):
lines[i] = new_line
found = True
break
# If the key wasn't there, tell the user
if not found:
input("Not found, press ENTER to continue...")
return None
# Write the updated content back to the file
with open(filename, "w") as f:
f.writelines(lines)
print("Successfully updated.")
# ----- SETTING CONFIG VALUES ----- #
# Come on go edit the config.txt file if u want params, or use the in-script config editor
# textfile length specifier, important if u want to swap the default wordlist for a new one.
# If lower than actual will not use all, if higher than actual will be out of index
textfile_length = get_config_value("textfile_length")
# Username random keyword number constraints
keyword_min = get_config_value("keyword_min")
keyword_max = get_config_value("keyword_max")
# Username random number constraints
random_int_min = get_config_value("random_int_min")
random_int_max = get_config_value("random_int_max")
# Password length constraints
password_length_min = get_config_value("password_length_min")
password_length_max = get_config_value("password_length_max")
# Random Snippet Generator Word Count
wordcount_min = get_config_value("wordcount_min")
wordcount_max = get_config_value("wordcount_max")
def update_config():
global textfile_length, keyword_min, keyword_max, random_int_min, random_int_max, password_length_min, password_length_max
textfile_length = get_config_value("textfile_length")
# Username random keyword number constraints
keyword_min = get_config_value("keyword_min")
keyword_max = get_config_value("keyword_max")
# Username random number constraints
random_int_min = get_config_value("random_int_min")
random_int_max = get_config_value("random_int_max")
# Password length constraints
password_length_min = get_config_value("password_length_min")
password_length_max = get_config_value("password_length_max")
# Random Snippet Generator Word Count
wordcount_min = get_config_value("wordcount_min")
wordcount_max = get_config_value("wordcount_max")
# ----- RANDOM WORD FUNCTION ----- #
# The parent of many to follow
def random_word(target_index):
with open('1-1000.txt', 'r', encoding='utf-8') as file:
for current_index, line in enumerate(file, 1):
if current_index == target_index:
return line.strip()
# ----- THE FUNCTIONAL FUNCTIONS ----- #
# Wordplay, eh?
def generate_password():
characters = string.ascii_letters + string.digits + string.punctuation
length = random.randint(password_length_min, password_length_max)
random_str = ''.join(secrets.choice(characters) for _ in range(length))
return random_str
def generate_username():
username_buffer = ""
for i in range(random.randint(keyword_min, keyword_max)):
username_buffer += random_word(random.randint(1, textfile_length)) + "_"
return f"{username_buffer.strip("_")}{random.randint(random_int_min, random_int_max)}"
def prompt_destroyer():
pd_buffer = ""
for i in range(random.randint(wordcount_min, wordcount_max)):
pd_buffer += random_word(random.randint(1, textfile_length)) + " "
return pd_buffer.strip()
# ----- BIG 'OL MAIN ----- #
if __name__ == "__main__":
while True:
# TITLE
print()
print("=" * 40)
print("PSecuritySuite V. A-1-ii \"DWeb\" by P7MJ")
print("=" * 40)
# REGULAR OPTIONS
print("[1] Username & Password Generator")
print("[2] Random Snippet Generator")
print("")
# SPECIAL OPTIONS
print("[c] Edit Configuration")
print("[h] Help Section")
print("[x] Exit")
print("")
main_menu_choice = input(" > ") # INPUT
# USERNAME & PASSWORD GENERATOR
if main_menu_choice == "1":
username = generate_username()
password = generate_password()
print("\nGenerated Credentials")
print(f" Username: {username}")
print(f" Password: {password}")
input("\nPRESS ENTER TO CONTINUE")
# RANDOM SNIPPET GENERATOR
if main_menu_choice == "2":
print("\nGenerated Snippet")
print(prompt_destroyer())
input("\nPRESS ENTER TO CONTINUE")
# EDIT CONFIG
if main_menu_choice == "c" or main_menu_choice == "C":
while True:
print("\nCURRENT CONFIG\n--------------------")
with open("config.txt", "r") as f:
for line in f:
print(line.strip())
print("--------------------")
print("Which config do you want to edit? (enter \"e\" to exit)")
config_name = input("Config name > ")
if config_name == "e" or config_name == "E":
break
config_value = input("Value > ")
if config_name != "" and config_name.isdigit():
set_config_value(config_name, config_value)
update_config()
elif not config_name.isdigit():
print("Not a natural number!")
if main_menu_choice == "h" or main_menu_choice == "H":
print("\nHELP SECTION\n--------------------")
with open("help_section.txt", "r") as f:
for line in f:
# .strip() removes the extra newline (\n) at the end of each line
print(line.strip())
print("--------------------")
input("PRESS ENTER TO CONTINUE")
if main_menu_choice == "x" or main_menu_choice == "X":
sys.exit(0)