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}

相关推荐
程序设计实验室15 小时前
2025年了,在 Django 之外,Python Web 框架还能怎么选?
python
倔强青铜三17 小时前
苦练Python第46天:文件写入与上下文管理器
人工智能·python·面试
用户25191624271120 小时前
Python之语言特点
python
刘立军20 小时前
使用pyHugeGraph查询HugeGraph图数据
python·graphql
数据智能老司机1 天前
精通 Python 设计模式——创建型设计模式
python·设计模式·架构
数据智能老司机1 天前
精通 Python 设计模式——SOLID 原则
python·设计模式·架构
c8i1 天前
django中的FBV 和 CBV
python·django
c8i1 天前
python中的闭包和装饰器
python
LH_R1 天前
OneTerm开源堡垒机实战(三):功能扩展与效率提升
运维·后端·安全
这里有鱼汤1 天前
小白必看:QMT里的miniQMT入门教程
后端·python