xctf攻防世界 CRYPTO高手进阶区 sherlock

1. 进入环境,下载附件

题目给出堆文字

xctf攻防世界 CRYPTO高手进阶区 sherlock_第1张图片

2. 问题分析

猜测可能存在flag,直接尝试搜索,发现没有任何有用的线索,观察发现文本中随机出现大写字母,想办法提取处这些字符。

[‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’, ‘E’, ‘R’, ‘O’, ‘O’, ‘N’, ‘E’, ‘Z’,…]

发现字符要么是ZERO要么是ONE,将其替换后发现是一串0101的字符串,长度够长,尝试将其转换成ASCII码,果然出答案。

3. 代码走起

with open('pic/f590c0f99c014b01a5ab8b611b46c57c.txt', 'r') as file:
    content = file.read()
    uppers = []
    for character in content:
        if 'Z' >= character >= 'A':
            uppers.append(character)
    print(uppers)

# 发现所有的字符是'ZERO'和'ONE'
uppers_str = ''.join(uppers)
uppers_str = uppers_str.replace('ZERO', '0')
uppers_str = uppers_str.replace('ONE', '1')

flag = ''.join(chr(int(uppers_str[i : i+8], 2)) for i in range(0, len(uppers_str), 8))
print(flag)

最终答案为:BITSCTF{h1d3_1n_pl41n_5173}

你可能感兴趣的:(攻防世界crypto之路,crypto)