BugKu Reverse——convert

 下载附件得到一堆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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值