#加冒号脚本 f=open('usbdata.txt','r') fi=open('out.txt','w') while1: a=f.readline().strip() if a: if len(a)==8: #鼠标流量 #if len(a)==16: #键盘流量 out='' for i in range(0,len(a),2): if i+2 != len(a): out+=a[i]+a[i+1]+":" else: out+=a[i]+a[i+1] fi.write(out) fi.write('\n') else: break
#转换坐标轴脚本 nums = [] keys = open('out.txt','r') f = open('xy.txt','w') posx = 0 posy = 0 for line in keys: if len(line) != 12 : continue x = int(line[3:5],16) y = int(line[6:8],16) if x > 127 : x -= 256 if y > 127 : y -= 256 posx += x posy += y btn_flag = int(line[0:2],16) # 1 for left , 2 for right , 0 for nothing if btn_flag == 2 : # 1 f.write(str(posx)) f.write(' ') f.write(str(posy)) f.write('\n')
f.close()
键盘流量
Maybe you could buy me a cup of coffee.
Scan this qrcode
Open alipay app scan this qrcode, buy me a coffee!
Scan this qrcode
Open wechat app scan this qrcode, buy me a coffee!