File size: 1,085 Bytes
6ca0072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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