0
点赞
收藏
分享

微信扫一扫

Spring Boot 学习(4)——开发环境升级与项目 jdk 升级

张宏涛心理 11小时前 阅读 0

系列文章目录

文章目录


前言

一、生成密码字典

1.python程序

import string
 
# 定义密码字符集,这里以小写字母为例
#all_characters = string.ascii_lowercase
all_characters = "TL1234567890tlNLnl.+-"
 
# 生成密码的函数
def generate_passwords(characters, min_length, max_length):
    for length in range(min_length, max_length + 1):
        for combination in itertools.product(characters, repeat=length):
            password = ''.join(combination)
            yield password
 
# 使用itertools.product来生成所有可能的组合
import itertools
 
# 设定密码最小长度和最大长度
min_length = 2
max_length = 6
 
# 打开文件用于写入密码
with open('passwords.txt', 'w') as file:
    for password in generate_passwords(all_characters, min_length, max_length):
        print(password)  # 打印密码
        file.write(password + '\n')  # 将密码写入文件

二、测试打开Word

1.python程序

#pip install msoffcrypto-tool
#如果你在使用中国大陆的网络环境,可能需要使用国内的镜像源,如清华大学的镜像源:pip install msoffcrypto-tool -i https://pypi.tuna.tsinghua.edu.cn/simple

from msoffcrypto import OfficeFile
import itertools
 
# 密码字典文件路径
dict_path = 'passwords.txt'
 
# Word文档文件路径
word_file = '111.docx'
 
# 读取密码字典
with open(dict_path, 'r') as f:
    passwords = f.readlines()
 
# 去除密码字典中的空白字符(例如换行符)
passwords = [passwd.strip() for passwd in passwords]
 
# 尝试打开Word文档
for password in passwords:
    try:
        of = OfficeFile(word_file)
        of.load_key(password)
        of.decrypt()
        of.save_as('decrypted.docx')
        print(f'Password found: {password}')
        break
    except Exception as e:
        print(f'Failed to open with password: {password}')
        continue

总结

分享:
假如我们失去某种心爱之物,会在我们心中留下阴影,甚至因此备受折磨,究其原因,就是因为我们没有调整心态去面对失去。

举报

相关推荐

0 条评论