Skip to content

Commit 52de5bc

Browse files
authored
greatearno
Program to crack Password in Python
1 parent 229f8d6 commit 52de5bc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

greatearno

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# importing random
2+
from random import *
3+
4+
# taking input from user
5+
user_pass = input("Enter your password")
6+
7+
# storing alphabet letter to use thm to crack password
8+
password = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k',
9+
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't','u','v',
10+
'w', 'x', 'y', 'z',]
11+
12+
# initializing an empty string
13+
guess = ""
14+
15+
16+
# using while loop to generate many passwords untill one of
17+
# them does not matches user_pass
18+
while (guess != user_pass):
19+
guess = ""
20+
# generating random passwords using for loop
21+
for letter in range(len(user_pass)):
22+
guess_letter = password[randint(0, 25)]
23+
guess = str(guess_letter) + str(guess)
24+
# printing guessed passwords
25+
print(guess)
26+
27+
# printing the matched password
28+
print("Your password is",guess)

0 commit comments

Comments
 (0)