【Python安全常用脚本】国内机构常用字典规律生成器

国内机构常用字典规律生成器-默认生成1W

#!/usr/bin/env python3

import itertools
import io

def generate_special_chars_passwords():
    passwords = []
    chars = '!@#$%^&*()'
    for i in range(1, 11):
        passwords.append(''.join(chars[:i]))
    print(passwords)
    return passwords

def generate_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 abbreviation
    for sp_char in special_chars:
        passwd_list.append(sp_char + abbr)
        passwd_list.append(abbr + sp_char)
        
    # Add special chars inside abbreviation
    for i in range(len(abbr)):
        for sp_char in special_chars:
            passwd = abbr[:i] + sp_char + abbr[i:]
            passwd_list.append(passwd)
            
    # Combine abbreviation and years
    for 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 passwords
    for 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) if len(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 file
    buffer = io.BytesIO()
    buffer.write(b'\n'.join(bytes(x, 'utf-8') for x in passwords))
    
    with open('passwords.txt', 'wb+') as f:
        f.write(buffer.getvalue())
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值