1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +00:00
trezor-firmware/send_udp.py

24 lines
568 B
Python
Raw Normal View History

2016-04-29 12:49:47 +00:00
#!/usr/bin/python
import socket
import os
2016-05-19 14:47:00 +00:00
from binascii import unhexlify
2016-04-29 12:49:47 +00:00
UDP_IP = os.getenv('TREZOR_UDP_IP', '127.0.0.1')
UDP_PORT = int(os.getenv('TREZOR_UDP_PORT', '21324'))
2016-05-19 14:47:00 +00:00
INITIALIZE = b'?##\x00\x00\x00\x00\x00\x00'
GET_PUBLIC_KEY = b'?##\x00\x0b\x00\x00\x00\r\x12\tsecp256k1\x18\x00'
PIN_MATRIX_ACK = b'?##\x00\x13\x00\x00\x00\x05\n\x03268'
messages = [
INITIALIZE,
# GET_PUBLIC_KEY,
# PIN_MATRIX_ACK,
]
2016-04-29 12:49:47 +00:00
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
2016-05-19 14:47:00 +00:00
sock.sendto(messages.pop(0), (UDP_IP, UDP_PORT))
2016-05-06 00:11:25 +00:00
while True:
print(sock.recv(64))