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 小时前
【软考信息安全】第一章 网络安全基础、管理与法律法规
安全·web安全·php
智能体与具身智能8 小时前
TVA具身智能的概念、架构与应用(19)
人工智能·python·具身智能
李帅朋8 小时前
微分基本定义笔记
人工智能·笔记·深度学习·神经网络
2601_962294619 小时前
python中range函数怎么用
python·for循环·可迭代对象·range函数·整数列表
商业看点解说10 小时前
企业需要为大模型应用设置安全护栏,推荐使用哪些生成式AI平台?
人工智能·安全
青 春 记 忆10 小时前
零基础入门python70:Docker Compose 编排完整后端
python·后端开发
新时代牛马10 小时前
字符设备驱动完整篇:从 cdev_add、file_operations 到chrdev_open 与排障
开发语言·python
是隼人11 小时前
buuctf-pwn inndy_echo(32位fmt)题解(学习过程持续更新)
c语言·学习·安全·pwn入门·ctf入门
白山编程大哥11 小时前
Java OutputStreamWriter 详解:从字符到字节的桥梁
java·开发语言·python
xian_wwq11 小时前
【学习笔记】深度认知系列-第16讲-提示词工程
人工智能·笔记·学习