Repository navigation
Expand file tree
/
Copy pathStudentPasswordGeneratorCGPT.py
More file actions
109 lines (86 loc) · 3.4 KB
/
Copy pathStudentPasswordGeneratorCGPT.py
File metadata and controls
109 lines (86 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import random
import string
import re
# ---------------- CONFIG ----------------
TOTAL_PASSWORDS = 6000
DIGITS_AT_END = 3
VOWELS = "aeiou"
CONSONANTS = "bcdfghjkmnprstvwxz" # removed ambiguous / harsh sounds
SYMBOL_SUBS = {
'a': '@',
's': '$',
'i': '!',
'l': '!',
'e': '&'
}
SYMBOLS = list(set(SYMBOL_SUBS.values()))
# Very conservative blacklist (can be expanded)
OFFENSIVE_SUBSTRINGS = {
# General profanity
"fuck", "shit", "damn", "hell", "piss", "crap", "bitch", "bastard",
# Anatomical/Sexual terms
"sex", "porn", "anal", "ass", "butt", "tit", "boob", "penis", "dick",
"vagina", "cunt", "clit", "balls", "nuts", "jizz", "shaft", "hardon",
# Slurs and Hate Speech (Crucial for school environments)
"fag", "gay", "homo", "nigger", "spic", "chink", "kike", "retard",
# Common insults/Mean-spirited words
"dumb", "stupid", "idiot", "fat", "ugly", "obese", "loser", "hate",
"kill", "die", "slave", "nazi", "hitler","obese",
"nigger", "nigga", "fag", "faggot", "kike", "spic", "chink", "cunt",
"retard", "tranny", "dyke", "nazi", "hitler", "negro",
# --- Tier 2: Sexual & Anatomical Slang ---
"fuck", "shit", "bitch", "whore", "slut", "porn", "anal", "vagina",
"penis", "dick", "cock", "tits", "boob", "clit", "jizz", "cum",
"boner", "balls", "nuts", "bastard", "twat", "wanker", "prick",
# --- Tier 3: Modern Internet Slang & Evasion Terms ---
"seggs", "unalive", "kys", "stfu", "pwned", "haxor", "n00b", "leets",
# --- Tier 4: School-Specific Mean-Spirited Words ---
"ugly", "fat", "obese", "stupid", "idiot", "dumb", "loser", "hate",
"kill", "die", "slave", "freak", "weirdo", "scum", "trash"
}
# ----------------------------------------
def is_safe(word):
lowered = word.lower()
return not any(bad in lowered for bad in OFFENSIVE_SUBSTRINGS)
def make_pronounceable_base():
# Alternating consonant/vowel pattern: CVCVC
base = ""
for i in range(5):
if i % 2 == 0:
base += random.choice(CONSONANTS)
else:
base += random.choice(VOWELS)
return base
def apply_symbol_substitution(word):
candidates = [i for i, c in enumerate(word) if c in SYMBOL_SUBS]
if not candidates:
return None
idx = random.choice(candidates)
return word[:idx] + SYMBOL_SUBS[word[idx]] + word[idx+1:]
def generate_password():
while True:
base = make_pronounceable_base()
if not is_safe(base):
continue
with_symbol = apply_symbol_substitution(base)
if not with_symbol:
continue
# FIXED: These lines are now properly indented inside the loop
capital = random.choice(string.ascii_uppercase)
digits = ''.join(random.choices(string.digits, k=DIGITS_AT_END))
password = capital + with_symbol + digits
return password # Return immediately once a valid password is built
def generate_unique_passwords(n):
passwords = set()
attempts = 0
max_attempts = n * 100 # Safety to prevent infinite loop
while len(passwords) < n and attempts < max_attempts:
passwords.add(generate_password())
attempts += 1
return sorted(passwords)
# --------- RUN + EXPORT ----------
passwords = generate_unique_passwords(TOTAL_PASSWORDS)
with open("student_passwords.csv", "w") as f:
for p in passwords:
f.write(p + "\n")
print(f"Generated {len(passwords)} passwords.")