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}

相关推荐
川石课堂软件测试8 分钟前
自动化测试的基本概念及常用框架
数据库·python·功能测试·测试工具·单元测试·自动化·流程图
灰勒塔德11 分钟前
jetson orin nano super开发指南
linux·服务器·python
摇滚侠16 分钟前
2025最新 SpringCloud 教程,Seata-原理-二阶提交协议,笔记70
笔记·spring·spring cloud
82782093719 分钟前
python scp 备份
开发语言·python
poggioxay30 分钟前
JAVA零基础入门知识3(持续更新中)
java·开发语言·python
im_AMBER36 分钟前
Leetcode 67 长度为 K 子数组中的最大和 | 可获得的最大点数
数据结构·笔记·学习·算法·leetcode
浩浩测试一下36 分钟前
C&&汇编中的调用约定
大数据·汇编·安全·web安全·网络安全·系统安全
serve the people40 分钟前
TensorFlow 基础训练循环(简化版 + 补全代码)
人工智能·python·tensorflow
木里先森41 分钟前
解决报错:/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32‘ not found
linux·python
爱打代码的小林44 分钟前
numpy库数组笔记
笔记·python·numpy