bugku convert

打开题目,全是二进制数字,根据题目名字,转换,于是写了一个脚本,将保存在1.txt的二进制数转换成十六进制

with open('2.txt','w',encoding='utf-8') as f1:
    with open('1.txt',encoding='utf-8') as f2:
        while True:
            temp = f2.read(4)
            if temp:
                temp = int(temp,base=2)
                temp = hex(temp)
                f1.write(temp[2:])
            else:
                break

再用Notepad++自带的十六进制转ascii,发现rar文件头,将文件另存为一个rar文件

解压是一个图片,在图片信息处发现一串base64,解码,得到flag

bugku convert

 flag{01a25ea3fd6349c6e635a1d0196e75fb}