NewStarCTF 2023 base!
base64隐写
脚本:
import base64
path = r'.\base.txt'
file = open(path)
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
aaa = ''
while True:
text = file.readline() # 只读取一行内容
# 判断是否读取到内容
text = text.replace("\n", "")
if not text:
break
if text.count('=') == 1:
aaa = aaa + \
str('{:02b}'.format((a.find(text[len(text)-2])) % 4))
if text.count('=') == 2:
aaa = aaa + \
str('{:04b}'.format((a.find(text[len(text)-3])) % 16))
file.close()
t = ""
ttt = len(aaa)
ttt = ttt//8*8
for i in range(0,ttt,8):
t = t + chr(int( aaa[i:i+8],2))
print(t)
得到隐写数据:
iDMb6ZMnTFMtFuouYZHwPTYAoWjC7Hjca8
然后用cyberchef自动解密

flag:
flag{b4se_1s_4_g0od_c0d3}

浙公网安备 33010602011771号