A-1-i DWeb
This commit is contained in:
201
PSecuritySuite-A-1-i.py
Normal file
201
PSecuritySuite-A-1-i.py
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
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-i "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.
|
||||||
|
|
||||||
|
# ----- 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, add it to the end
|
||||||
|
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, 1000)) + " "
|
||||||
|
return pd_buffer.strip()
|
||||||
|
|
||||||
|
# ----- BIG 'OL MAIN ----- #
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
while True:
|
||||||
|
|
||||||
|
# TITLE
|
||||||
|
print()
|
||||||
|
print("=" * 40)
|
||||||
|
print("PSecuritySuite V. A-1-i \"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 != "":
|
||||||
|
set_config_value(config_name, config_value)
|
||||||
|
update_config()
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
9
config.txt
Normal file
9
config.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
textfile_length: 1000
|
||||||
|
keyword_min: 2
|
||||||
|
keyword_max: 4
|
||||||
|
random_int_min: 1
|
||||||
|
random_int_max: 99999
|
||||||
|
password_length_min: 20
|
||||||
|
password_length_max: 40
|
||||||
|
wordcount_min: 10
|
||||||
|
wordcount_max: 20
|
||||||
29
help_section.txt
Normal file
29
help_section.txt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
USERNAME AND PASSWORD GENERATOR
|
||||||
|
Usage: Main Menu -> 1
|
||||||
|
Purpose: Generates a random username and password
|
||||||
|
What to use for: Any type of random account
|
||||||
|
Note: Can be configured
|
||||||
|
|
||||||
|
RANDOM SNIPPET GENERATROR
|
||||||
|
Usage: Main Menu -> 2
|
||||||
|
Purpose: Generates a random paragraph of words
|
||||||
|
What to use for: Overwriting sensitive information
|
||||||
|
Note: Can be configured
|
||||||
|
|
||||||
|
EDIT CONFIGURATION
|
||||||
|
Usage: Main Menu -> C -> (config name) -> (config value)
|
||||||
|
Purpose: Edits configuration for 1 and 2
|
||||||
|
What to use for: Customizing generators
|
||||||
|
Note: Make sure config name exists, and config value is a natural number
|
||||||
|
|
||||||
|
HELP
|
||||||
|
Usage: Main Menu -> H
|
||||||
|
Purpose: Detailed page for usage, purpose, use cases, and notes
|
||||||
|
What to use for: When you feel dumb
|
||||||
|
Note: You are here right now, so, technically, this is redundant
|
||||||
|
|
||||||
|
EXIT
|
||||||
|
Usage: Main Menu -> E
|
||||||
|
Purpose: Exit the program
|
||||||
|
What to use for: When you get enough generated text
|
||||||
|
Note: Its name says everything
|
||||||
Reference in New Issue
Block a user