Crack Any Password Using Python

 

Crack Any Password Using Python

Today we will see a basic program that is basically a hint to brute force attack to crack passwords. In other words, we will make a program to Crack Any Password Using Python

So, we are applying brute force attack here with the help of while loop in python.

Now, what a brute force is?

Brute force is defined as an attack to crack passwords where we submit many passwords guessing that any of the passwords which we are submitting may work.

So, the process is something like that we will ask the user to enter some characters i.e. password, and then we will try to guess the password using brute force attack.

Now let’s see and understand the code:


Source Code:

  1. # importing random

from random import *

  1. # taking input from user

user_pass = input("Enter your password")


# storing alphabet letter to use thm to crack password

password = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k', 

            'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't','u','v', 

            'w', 'x', 'y', 'z',]


# initializing an empty string

guess = ""



# using while loop to generate many passwords untill one of

# them does not matches user_pass

while (guess != user_pass):

    guess = ""

    # generating random passwords using for loop

    for letter in range(len(user_pass)):

        guess_letter = password[randint(0, 25)]

        guess = str(guess_letter) + str(guess)

    # printing guessed passwords

    print(guess)

    

# printing the matched password

print("Your password is",guess)


On running of the program, while loop will print a random password every time on execution until the password entered by the user matches the guess of our program. So is a basic program which is basically a hint to brute force attack to crack passwords if you have any query on our program to Crack Any Password Using Python, then comment.


PYTHON

You Might Also Like

0 Comments