赞
踩
tokeii的where is flag系列第五题嘎嘎上新
文本内容:
Gx8EAA8SCBIfHQARCxMUHwsAHRwRHh8BEQwaFBQfGwMYCBYRHx4SBRQdGR8HAQ0QFQ==
import base64
enc = 'Gx8EAA8SCBIfHQARCxMUHwsAHRwRHh8BEQwaFBQfGwMYCBYRHx4SBRQdGR8HAQ0QFQ=='
print(base64.b64decode(enc))
得到一串如下字节
b'\x1b\x1f\x04\x00\x0f\x12\x08\x12\x1f\x1d\x00\x11\x0b\x13\x14\x1f\x0b\x00\x1d\x1c\x11\x1e\x1f\x01\x11\x0c\x1a\x14\x14\x1f\x1b\x03\x18\x08\x16\x11\x1f\x1e\x12\x05\x14\x1d\x19\x1f\x07\x01\r\x10\x15'
enc = 'Gx8EAA8SCBIfHQARCxMUHwsAHRwRHh8BEQwaFBQfGwMYCBYRHx4SBRQdGR8HAQ0QFQ=='
text = base64.b64decode(enc)
bin_data = ["0"*(5-len(i))+i if len(i)!=5 else i for i in [bin(j).replace('0b','') for j in text]]
得到如下数据:
11011 11111 00100 00000 01111 10010 01000 10010 11111 11101 00000 10001 01011 10011 10100 11111 01011 00000 11101 11100 10001 11110 11111 00001 10001 01100 11010 10100 10100 11111 11011 00011 11000 01000 10110 10001 11111 11110 10010 00101 10100 11101 11001 11111 00111 00001 01101 10000 10101
循环将每一个二进制的相同位数的数据取出,再以长度7切片转换为字符
flag = ''
data1 = ''
for j in range(5):
for i in bin_data:
data1 +=i[j]
for k in range(0,len(data1),7):
flag +=chr(int(str(data1[k:k+7]),2))
import base64
enc = 'Gx8EAA8SCBIfHQARCxMUHwsAHRwRHh8BEQwaFBQfGwMYCBYRHx4SBRQdGR8HAQ0QFQ=='
text = base64.b64decode(enc)
bin_data = ["0"*(5-len(i))+i if len(i)!=5 else i for i in [bin(j).replace('0b','') for j in text]]
flag = ''
data1 = ''
for j in range(5):
for i in bin_data:
data1 +=i[j]
for k in range(0,len(data1),7):
flag +=chr(int(str(data1[k:k+7]),2))
print(flag)
python一句话解题脚本
#whereiflag.txt与该脚本放置在同一目录下
print((lambda x : "".join([chr(int(x[i:i+7], 2)) for i in range(0, len(x), 7)]))("".join([p[k] for k in range(5) for p in ["0"*(5-len(i))+i if len(i)!=5 else i for i in [bin(j).replace('0b','') for j in __import__('base64').b64decode(open('whereiflag5.txt','rb').read().replace(b'\n',b'').replace(b'\r',b''))]]])))
flag:
bugku{ce26f61d40fea75fc0b980d7588e}
【喜欢周周ovo】
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。