Skip to content

Commit 42acc72

Browse files
committed
update the wordlist from the-big-username-blacklist
1 parent 8784b15 commit 42acc72

4 files changed

Lines changed: 425 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ The default regular expression is as follows:
5656
(?<![.-]) # no - or . at the end
5757
$ # end of string
5858

59+
## Credits
60+
61+
- [The-Big-Username-Blocklist](https://github.com/marteinn/The-Big-Username-Blocklist)
62+
5963
## Further Reading
6064

6165
- [Let’s talk about

scripts/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Scripts
2+
3+
Utility scripts for maintaining the python-usernames project.
4+
5+
## merge_words.py
6+
7+
Merges new words into the `words.txt` file while deduplicating entries and maintaining alphabetical order.
8+
9+
### Usage
10+
11+
```bash
12+
# From a file
13+
cat new_words.txt | python scripts/merge_words.py
14+
15+
# Using echo
16+
echo -e "newword1\nnewword2\nnewword3" | python scripts/merge_words.py
17+
18+
# From clipboard (macOS)
19+
pbpaste | python scripts/merge_words.py
20+
21+
# Interactive input (Ctrl+D to finish)
22+
python scripts/merge_words.py
23+
```
24+
25+
### Features
26+
27+
- Reads words from stdin (one word per line)
28+
- Automatically converts words to lowercase
29+
- Deduplicates against existing words
30+
- Maintains alphabetical ordering
31+
- Provides progress feedback and statistics
32+
- Skips empty lines
33+
34+
### Example
35+
36+
```bash
37+
$ echo -e "admin\nnewword\nexample" | python scripts/merge_words.py
38+
Reading existing words from .../src/python_usernames/words.txt...
39+
Found 527 existing words
40+
Reading new words from stdin...
41+
Read 3 new words from stdin
42+
Total unique words after merge: 528
43+
New words added: 1
44+
Duplicates skipped: 2
45+
Writing merged words back to .../src/python_usernames/words.txt...
46+
✓ Successfully merged words!
47+
```

scripts/merge_words.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Utility script to merge new words into words.txt file.
4+
5+
Reads words from stdin (one word per line) and merges them with existing
6+
words in the words.txt file, deduplicating any entries and maintaining
7+
alphabetical order.
8+
9+
Usage:
10+
cat new_words.txt | python scripts/merge_words.py
11+
echo -e "newword1\nnewword2" | python scripts/merge_words.py
12+
"""
13+
14+
import sys
15+
from pathlib import Path
16+
17+
18+
def main():
19+
# Determine the path to words.txt
20+
script_dir = Path(__file__).parent
21+
project_root = script_dir.parent
22+
words_file = project_root / "src" / "python_usernames" / "words.txt"
23+
24+
if not words_file.exists():
25+
print(f"Error: words.txt not found at {words_file}", file=sys.stderr)
26+
sys.exit(1)
27+
28+
# Read existing words from words.txt
29+
print(f"Reading existing words from {words_file}...", file=sys.stderr)
30+
with open(words_file, "r", encoding="utf-8") as f:
31+
existing_words = set(line.strip().lower() for line in f if line.strip())
32+
33+
print(f"Found {len(existing_words)} existing words", file=sys.stderr)
34+
35+
# Read new words from stdin
36+
print("Reading new words from stdin...", file=sys.stderr)
37+
new_words = set()
38+
for line in sys.stdin:
39+
word = line.strip().lower()
40+
if word: # Skip empty lines
41+
new_words.add(word)
42+
43+
print(f"Read {len(new_words)} new words from stdin", file=sys.stderr)
44+
45+
# Merge and deduplicate
46+
all_words = existing_words | new_words
47+
48+
# Count how many new words were actually added
49+
added_count = len(all_words) - len(existing_words)
50+
duplicate_count = len(new_words) - added_count
51+
52+
print(f"Total unique words after merge: {len(all_words)}", file=sys.stderr)
53+
print(f"New words added: {added_count}", file=sys.stderr)
54+
print(f"Duplicates skipped: {duplicate_count}", file=sys.stderr)
55+
56+
# Sort alphabetically
57+
sorted_words = sorted(all_words)
58+
59+
# Write back to words.txt
60+
print(f"Writing merged words back to {words_file}...", file=sys.stderr)
61+
with open(words_file, "w", encoding="utf-8") as f:
62+
for word in sorted_words:
63+
f.write(f"{word}\n")
64+
65+
print("✓ Successfully merged words!", file=sys.stderr)
66+
67+
68+
if __name__ == "__main__":
69+
main()

0 commit comments

Comments
 (0)