下载得到图片
010editor发现文件尾有大量数据,为16进制数据
将16进制数据复制到 hex.txt 利用脚本转化为 ascii 获取坐标点
with open('hex.txt', 'r') as h:
h = h.read()
with open('./ascii.txt', 'a') as a:
for i in range(0, len(h), 2):
tmp = '0x'+h[i]+h[i+1]
tmp = int(tmp, base=16)
if chr(tmp) != '(' and chr(tmp) != ')':
a.write(chr(tmp))
用 matplotlib 绘图得到二维码
import matplotlib.pyplot as plt
import numpy as np
x, y = np.loadtxt('./ascii.txt', delimiter=',', unpack=True)
plt.plot(x, y, '.')
plt.show()
最终脚本
import matplotlib.pyplot as plt
import numpy as np
with open('hex.txt', 'r') as h:
h = h.read()
with open('./ascii.txt', 'a') as a:
for i in range(0, len(h), 2):
tmp = '0x'+h[i]+h[i+1]
tmp = int(tmp, base=16)
if chr(tmp) != '(' and chr(tmp) != ')':
a.write(chr(tmp))
x, y = np.loadtxt('./ascii.txt', delimiter=',', unpack=True)
plt.plot(x, y, '.')
plt.show()