Create wordlist_generator.py
Browse files- wordlist_generator.py +33 -0
wordlist_generator.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import random
|
| 2 |
+
import string
|
| 3 |
+
|
| 4 |
+
def generate_wordlist(size, min_length, max_length, special_chars=False, numbers=True):
|
| 5 |
+
"""
|
| 6 |
+
Generate a list of random words for penetration testing.
|
| 7 |
+
|
| 8 |
+
Parameters:
|
| 9 |
+
- size: Number of words to generate.
|
| 10 |
+
- min_length: Minimum length of each word.
|
| 11 |
+
- max_length: Maximum length of each word.
|
| 12 |
+
- special_chars: Whether to include special characters.
|
| 13 |
+
- numbers: Whether to include numbers.
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
- A list of randomly generated words.
|
| 17 |
+
"""
|
| 18 |
+
wordlist = []
|
| 19 |
+
|
| 20 |
+
# Define character sets based on user input
|
| 21 |
+
characters = string.ascii_lowercase # Base set of lowercase characters
|
| 22 |
+
if numbers:
|
| 23 |
+
characters += string.digits # Add digits if selected
|
| 24 |
+
if special_chars:
|
| 25 |
+
characters += string.punctuation # Add special characters if selected
|
| 26 |
+
|
| 27 |
+
# Generate words
|
| 28 |
+
for _ in range(size):
|
| 29 |
+
word_length = random.randint(min_length, max_length)
|
| 30 |
+
word = ''.join(random.choice(characters) for _ in range(word_length))
|
| 31 |
+
wordlist.append(word)
|
| 32 |
+
|
| 33 |
+
return wordlist
|