zip套娃爆破
exp
1 | |
import os
def find_deepest_txt_file(root_dir):
deepest_path = ‘’
max_depth = -1
txt_file_path = ‘’
for current_dir, dirs, files in os.walk(root_dir):
depth = current_dir.count(os.sep)
if depth > max_depth and any(f.endswith('.txt') for f in files):
max_depth = depth
deepest_path = current_dir
# 只读取第一个 .txt 文件(如果有多个可以改成循环)
for f in files:
if f.endswith('.txt'):
txt_file_path = os.path.join(current_dir, f)
break
if txt_file_path:
print(f'找到的最深层 .txt 文件路径是:\n{txt_file_path}\n')
with open(txt_file_path, 'r', encoding='utf-8') as file:
content = file.read()
print('文件内容如下:\n')
print(content)
else:
print('没有找到 .txt 文件')
if name == ‘main‘:
root_dir = ‘next_or_end/‘ # 可修改为你的起始目录
find_deepest_txt_file(root_dir)
例题
解不完的压缩包
这里附上爆破脚本(使用时记得修改初始设置)
1 | |
拿到1.zip

发现解压要密码

crcexp
1 | |

密码*m:#P7j0

更新: 2024-09-24 15:57:34
原文: https://www.yuque.com/chaye-apqbl/vsc85q/xqwsgv9y6oifi0yf
- | | |—| |import os| || |def find_deepest_txt_file(root_dir):| |deepest_path = ‘’| |max_depth = -1| |txt_file_path = ‘’| || |for current_dir, dirs, files in os.walk(root_dir):| |depth = current_dir.count(os.sep)| |if depth > max_depth and any(f.endswith(‘.txt’) for f in files):| |max_depth = depth| |deepest_path = current_dir| |# 只读取第一个 .txt 文件(如果有多个可以改成循环)| |for f in files:| |if f.endswith(‘.txt’):| |txt_file_path = os.path.join(current_dir, f)| |break| || |if txt_file_path:| |print(f’找到的最深层 .txt 文件路径是:\n{txt_file_path}\n’)| |with open(txt_file_path, ‘r’, encoding=’utf-8’) as file:| |content = file.read()| |print(‘文件内容如下:\n’)| |print(content)| |else:| |print(‘没有找到 .txt 文件’)| || |if name == ‘main‘:| |root_dir = ‘next_or_end/‘ # 可修改为你的起始目录| |find_deepest_txt_file(root_dir)| || ↩