Spaces:
Build error
Build error
import random | |
import string | |
def generate_wordlist(size, min_length, max_length, special_chars=False, numbers=True): | |
""" | |
Generate a list of random words for penetration testing. | |
Parameters: | |
- size: Number of words to generate. | |
- min_length: Minimum length of each word. | |
- max_length: Maximum length of each word. | |
- special_chars: Whether to include special characters. | |
- numbers: Whether to include numbers. | |
Returns: | |
- A list of randomly generated words. | |
""" | |
wordlist = [] | |
# Define character sets based on user input | |
characters = string.ascii_lowercase # Base set of lowercase characters | |
if numbers: | |
characters += string.digits # Add digits if selected | |
if special_chars: | |
characters += string.punctuation # Add special characters if selected | |
# Generate words | |
for _ in range(size): | |
word_length = random.randint(min_length, max_length) | |
word = ''.join(random.choice(characters) for _ in range(word_length)) | |
wordlist.append(word) | |
return wordlist | |