#!/usr/bin/env python3import itertools
import io
defgenerate_special_chars_passwords():
passwords =[]
chars ='!@#$%^&*()'for i inrange(1,11):
passwords.append(''.join(chars[:i]))print(passwords)return passwords
defgenerate_password_list(abbr, tel):
years =['2021','2022','2023']
special_chars =[]# Pre-generate special chars combinations
special_chars_passwords = generate_special_chars_passwords()
common_passwds =['123','1234','12345','123456','qwerty','password','@','2021','2022','2023']
passwd_list =[]# Add abbreviation
passwd_list.append(abbr)# Add special chars before and after abbreviationfor sp_char in special_chars:
passwd_list.append(sp_char + abbr)
passwd_list.append(abbr + sp_char)# Add special chars inside abbreviationfor i inrange(len(abbr)):for sp_char in special_chars:
passwd = abbr[:i]+ sp_char + abbr[i:]
passwd_list.append(passwd)# Combine abbreviation and yearsfor year in years:for sp_char in special_chars:
passwd_list.append(abbr + year + sp_char)
passwd_list.append(year + sp_char + abbr)# Combine abbreviation and phone number
passwd_list.append(abbr + tel)for sp_char in special_chars:
passwd_list.append(abbr + sp_char + tel)
passwd_list.append(tel + sp_char + abbr)# Add common passwordsfor passwd in common_passwds:
passwd_list.append(passwd)for sp_char in special_chars:
passwd_list.append(sp_char + passwd)
passwd_list.append(passwd + sp_char)# Add special chars combinations
passwd_list.extend(special_chars_passwords)print(passwd_list)from itertools import permutations
# Generate all possible non-repeating 3-tuples
non_repeating_tuples =set([t for t in permutations(passwd_list,3)iflen(set(t))==3])
passwd_perm_list =[]for tup in non_repeating_tuples:
passwd_perm_list.append(''.join(tup))print('Password permutation generation completed!')return passwd_perm_list
if __name__ =='__main__':# Example usage
abbr ='sdu'
tel ='88888888'
passwords = generate_password_list(abbr, tel)# Save passwords to filebuffer= io.BytesIO()buffer.write(b'\n'.join(bytes(x,'utf-8')for x in passwords))withopen('passwords.txt','wb+')as f:
f.write(buffer.getvalue())