Created
February 7, 2021 15:01
-
-
Save im-noob/b032a54a03610059afafac9a7901811b to your computer and use it in GitHub Desktop.
Password Guessing Technique in python algo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import permutations | |
password = [ | |
'rahul', | |
'kumar', | |
'rina', | |
'kumari', | |
'2001', | |
'2001', | |
'loves' | |
] | |
# List of possible Combination | |
is_possibles = [ | |
['2002','loves','rahul',], | |
['2000','loves','rahul',], | |
['2000','loves','rina',], | |
['2002','loves','rina',], | |
['2000','loves','kumar',], | |
['2002','loves','kumar',], | |
['kumar','rina','kumari','@'], | |
['kumar','rahul','kumari','@'] | |
] | |
unique = list(set(password)) | |
def possible(one_password): | |
flag = False | |
for is_possible in is_possibles: | |
inner_flag = True | |
for one_word in one_password: | |
if one_word not in is_possible: | |
inner_flag = False | |
break | |
if inner_flag: | |
flag = True | |
break | |
return flag | |
with open('final_list.txt','w') as file: | |
for i in range(3,5): # password Length | |
for one_password in permutations(unique,i): # genrating password | |
if possible(one_password): # checking for possible combination | |
file.write(''.join(one_password)+'\n',) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment