GXYCTF2019:gakki

把题目给的附件解压后给了张图片,顺带着瞟一眼属性,没有值得注意的

binwalk检测一手,看见有个rar压缩包

提取出来的压缩包是有密码的,但是题目并没有给出获取密码的途径,所以先爆破试试,用最常用的四位数爆破

果然是四位数密码的爆破,flag.txt里面是一大串的乱码

用python脚本进行字频统计

复制代码
import collections

def count_characters(filename):
    with open(filename, 'r', encoding='utf-8') as file:
        content = file.read()
        counter = collections.Counter(content)
        return counter

def print_sorted_counts(counter):
    for char, count in counter.most_common():
        print(f"'{char}': {count}")

def main():
    filename = input("请输入文本文件的路径:")
    try:
        char_counts = count_characters(filename)
        print_sorted_counts(char_counts)
    except FileNotFoundError:
        print("文件未找到,请检查路径是否正确。")
    except Exception as e:
        print(f"发生错误:{e}")

if __name__ == "__main__":
    main()

flag:flag{gaki_IsMyw1fe}

相关推荐
AI探索者15 小时前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者15 小时前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python
FishCoderh16 小时前
Python自动化办公实战:批量重命名文件,告别手动操作
python
躺平大鹅16 小时前
Python函数入门详解(定义+调用+参数)
python
曲幽17 小时前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama
两万五千个小时21 小时前
落地实现 Anthropic Multi-Agent Research System
人工智能·python·架构
哈里谢顿1 天前
Python 高并发服务限流终极方案:从原理到生产落地(2026 实战指南)
python
用户8356290780512 天前
无需 Office:Python 批量转换 PPT 为图片
后端·python
markfeng82 天前
Python+Django+H5+MySQL项目搭建
python·django
GinoWi2 天前
Chapter 2 - Python中的变量和简单的数据类型
python