下载附件得到一堆01代码,标题convert意思是转换,那么这些应该是二进制,我们尝试转为16进制试试。
打开文件,发现1和0总个数除以8余一个数,删0之后改名为1-0.txt
八位二进制对应两位十六进制,先8位一组用空格隔开,利用以下脚本
with open('C:/x/x/x/x/1-0.txt', 'r') as file: #路径推荐用绝对路径
binary_data = file.read().strip()
# Splitting the binary data into groups of 8 bits
binary_groups = [binary_data[i:i+8] for i in range(0, len(binary_data), 8)]
# Joining the groups with a space in between
formatted_data = ' '.join(binary_groups)
# Writing the formatted data to a new file
with open('C:/x/x/x/x/formatted_data.txt', 'w') as file:
file.write(formatted_data)
得到formatted_data.txt,再利用以下脚本转为16进制
with open('C:/x/x/x/x/formatted_data.txt', 'r') as file:
binary_data = file.read().strip()
# Splitting the formatted binary data by spaces
split_data = binary_data.split()
# Converting each binary group to hexadecimal
hex_data = [hex(int(group, 2))[2:] for group in split_data]
# Padding each hexadecimal value with leading zeros if necessary
padded_hex_data = [hex_val.zfill(2) for hex_val in hex_data]
# Joining the hexadecimal values together
hex_string = ''.join(padded_hex_data)
# Writing the hexadecimal data to a new file
with open('C:/x/x/x/x/hex_data.txt', 'w') as file:
file.write(hex_string)
利用010 Editor导入hex_data.txt
发现文件头是rar,另存为rar压缩包
解压后得到一张图片,表面没啥内容,在属性中看到一串base64
试着解码,得到flag