tpm2q3kled/send.py

22 lines
466 B
Python
Raw Normal View History

import sys
import struct
import socket
if __name__ == "__main__":
target = sys.argv[1]
width = int(sys.argv[2])
height = int(sys.argv[3])
size = width*height*3
prefix = struct.pack(
'!BBHBB', 0x9c, 0xda, size, 0, 1)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
buf = prefix + sys.stdin.read(size) + '\x36'
if len(buf) == 7:
exit(1)
sock.sendto(buf, (target, 65506))