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}

相关推荐
apocelipes11 小时前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
用户83562907805113 小时前
使用 Python 在 PDF 中创建与管理书签
后端·python
MeixianAgent17 小时前
Python 回测数据入口怎么验?历史 K 线入库前先做 5 个检查
后端·python
咕白m62521 小时前
用 Python 实现一键批量查找与替换 Excel 数据
后端·python
SelectDB2 天前
Apache Doris Python UDF:让 SQL 直接调用 Python 生态,支撑 Agent 时代复杂业务逻辑
大数据·数据库·python
泯泷2 天前
第 2 篇:设计第一套字节码:Opcode、Instruction 与 Constant Pool
前端·javascript·安全
泯泷2 天前
第 1 篇:从 1 + 2 开始:亲手写出第一台 JSVM
前端·javascript·安全
荣码2 天前
GraphRAG:普通RAG只能回答"点"的问题,我踩了4个坑才搞懂
java·python
金銀銅鐵2 天前
[Python] 基于欧几里得算法,实现分数约分计算器
python·数学
Lyn_Li2 天前
Kaggle Top 5 | 198只股票、200条数据的金融预测——BattleFin高分方案从零复现
python·kaggle·比赛复盘·金融预测