Created
February 5, 2017 11:40
-
-
Save ymgve/31e26b903f7dead6941a66ca8b790102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii, struct | |
from PIL import Image | |
f = open("mousestuff.pcap", "rb") | |
f.read(0x18) | |
im = Image.new("RGB", (1024, 1024)) | |
while True: | |
data = f.read(0x10) | |
if len(data) != 0x10: | |
break | |
ts, us, sz1, sz2 = struct.unpack("<IIII", data) | |
packet = f.read(sz1) | |
data = packet[64:] | |
if data[0:2] == "\x02\xf1": | |
x, y, z, p = struct.unpack("<HHHB", data[2:9]) | |
im.putpixel((x / 8, y / 8), (z / 256, p * 16, 0)) | |
im.save("test.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment