MRCTF2020:千层套路

附件给个压缩包,什么都没说,先尝试爆破(从四位数开始爆破)

解压完了发现里面还是一个压缩包,这个密码也是似曾相识,就是文件名,,到这里明白了千层套路的意思,估计是要上脚本了

复制代码
import os
import zipfile


def extract_and_store_final_file(initial_zip_path, target_dir):
    if not os.path.exists(target_dir):
        os.makedirs(target_dir)

    current_zip_path = initial_zip_path

    password = os.path.basename(initial_zip_path)[:4]

    while True:
        with zipfile.ZipFile(current_zip_path, 'r') as zip_ref:
            files = zip_ref.namelist()
            file_name = files[0]
            next_zip_name = os.path.join(target_dir, file_name)
            try:
                zip_ref.extractall(target_dir, pwd=bytes(password, 'utf-8'))
                print(f"Extracted {file_name} to {target_dir} using password {password}")
            except RuntimeError as e:
                print(f"Error extracting {file_name}: {e}")
                break

            if file_name.endswith('.zip'):
                current_zip_path = next_zip_name
                password = file_name[:4]
            else:

                print(f"The final file is {file_name}, stored in {target_dir}")
                break



initial_zip_path = '0573.zip'
target_dir = 'flag'
extract_and_store_final_file(initial_zip_path, target_dir)

脚本提取文件名的前四位作为密码,然后将解压后的文件都放进名为flag的文件夹中,直到解压出的文件后缀不是zip为止

看见了一个qr.zip文件解压看一眼

看着像是RGB数据串,随波逐流转图片,当然也可以使用脚本

转换完成后给了个二维码,扫一下就出来了

MRCTF{ta01uyout1nreet1n0usandtimes}

相关推荐
嘻嘻嘻开心4 分钟前
Collection接口
linux·windows·python
rebekk7 分钟前
什么时候会用到python -m
python
阿萨德528号8 分钟前
Maven 项目构建笔记 - 单体应用与简单微服务
笔记·微服务·maven
YJlio11 分钟前
Strings 学习笔记(12.1):从二进制里“扒”出明文信息的瑞士军刀
服务器·笔记·学习
是喵斯特ya21 分钟前
python开发web暴力破解工具(进阶篇 包含验证码识别和token的处理)
开发语言·python·web安全
长安牧笛22 分钟前
职业技能学习路径规划工具,用户输入目标岗位,如AI工程师,结合现有技能水平,推荐分阶段学习资源(课程/书籍/项目),设置学习进度提醒。
python
长安牧笛28 分钟前
智能衣柜—穿搭助手,内置温湿度传感器,潮湿天气启动除湿功能,防止衣服发霉,APP还能记录衣服穿着频率,推荐久没穿的衣服,避免穿搭重复。
python
Hunter11631 分钟前
Delphi通过ITHTTP传输有汉字乱码问题
笔记
free-elcmacom31 分钟前
机器学习高阶教程<8>分布式训练三大核心策略拆解
人工智能·分布式·python·机器学习
魔镜前的帅比40 分钟前
多工具组合执行链详解
python·ai