zodiac
OSCN 2025
Last updated
OSCN 2025
Last updated
import re
with open("sample.pcap", "rb") as f:
data = f.read()
pattern = re.compile(rb"(\d+\.\d+),(\d+),(\d+),True,False")
# Extract coordinates only when left click is True
matches = pattern.findall(data)
with open("left_click_coordinates.txt", "w") as out:
for match in matches:
x = match[1].decode()
y = match[2].decode()
out.write(f"{x},{y}\n")from PIL import Image, ImageDraw
import pandas as pd
# Load the coordinates
df = pd.read_csv("left_click_coordinates.txt", header=None, names=["x", "y"])
# Set canvas size
width, height = 1200, 800
image = Image.new("RGB", (width, height), "white")
draw = ImageDraw.Draw(image)
# Draw points
for x, y in df.values:
draw.point((x, y), fill="black")
image.save("output.png")
image.show()