Building a Powerful Password List Generator using Python - Aman Aadi

Building a Powerful Password List Generator using Python

Introduction:

In the digital age, strong and unique passwords are essential for protecting sensitive information and securing online accounts. Creating a password list generator using Python empowers us to generate complex and randomized passwords effortlessly. In this blog post, we’ll explore the process of building a password list generator using Python, equipping you with a powerful tool to enhance your security and you can also use this password list file in brute force attack to check the security. With just a few lines of code, you can strengthen your digital fortress and protect yourself from malicious actors attempting to breach your accounts.

Understanding the Python Password List Generator:

We are building a password list generator that create a text file of random and unique passwords. No two passwords will be the same in that .txt file.

How it works? firstly it ask from the user that what type of characters you want in your password like digits, capital case letters, small case letters and punctuation . Then it ask what will be the length of your password. And at the end it ask for the number of password you want to generate. and now it will give you a .txt file that contains all passwords according to your input or choice.

Requirements:

To get started, ensure you have Python installed on your computer. You can download the latest version from the official Python website (https://www.python.org/downloads/) and follow the installation instructions. Additionally, a code editor, such as Visual Studio Code or PyCharm, will make coding and testing more convenient.

In Python, we will use the random module to generate random characters for the passwords and string module to get al the string character. Both module are pre installed module of python so you don’t need to install them.

Python Code:

# Importing modules
import random
import string as st

# Getting inputs
password_characters = input("\nWhat you want in your password, Type:- \n[d] for digits\n[l] for lowercase\n[u] for uppercase\n[p] for punctuation\n[a] to use all\n>>> ")
password_length = int(input("\n[+] Enter length of password: "))
no_of_passwords = int(input("\n[+] Enter number of passwords you want to generate: "))


# Creating a function to generate a single random password as per user choice.
def password():
    characters = []
    digit = st.digits
    lower = st.ascii_lowercase
    upper = st.ascii_uppercase
    punctuation = st.punctuation

    if "d" in password_characters:
        characters += digit
    if "l" in password_characters:
        characters += lower
    if "u" in password_characters:
        characters += upper
    if "p" in password_characters:
        characters += punctuation
    if "a" in password_characters:
        characters += (digit + lower + upper + punctuation)

    random.shuffle(characters)
    password = ''.join(characters[:password_length])
    return password


# Creating a list of passwords that contain the number of passwords that user wants.
password_list = []
for i in range(no_of_passwords):
    password_list.append(password())

# As we know that python data type set does not contain duplicate elements so we are converting that password list into set so that no two passwords are same.
unique_passwords = set(password_list)

# Iterating over the set and saving each password in a passwords.txt file at the given path location.
with open("C:/Users/amant/Desktop/passwods.txt", 'w') as t:
    for pas in unique_passwords:
        t.write(f"{pas}\n")

print("\n")

Commands and Output:

These are the commands or inputs that is given by the user to the password list generator.

Building a Powerful Password List Generator using Python - Aman Aadi

Here you can see that it gave me output according to the choice or input of the user.

Building a Powerful Password List Generator using Python - Aman Aadi

Conclusion:

Creating a password list generator using Python empowers us to generate strong and unique passwords effortlessly. By implementing this simple yet powerful tool, you can enhance your online security and protect your sensitive information from potential cyber threats. You can also use this password text file in brute force attack to check the security and stay one step ahead of potential threats. Happy coding!

Discover more from Aman Aadi

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top