Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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