frame-it/python/sender.py

19 lines
486 B
Python
Raw Normal View History

2020-01-21 03:27:35 +01:00
import datetime
from _socket import socket, AF_PACKET, SOCK_RAW
from time import sleep
import utils
2020-01-22 19:43:45 +01:00
if __name__ == "__main__":
2020-01-21 03:27:35 +01:00
sock = socket(AF_PACKET, SOCK_RAW)
sock.bind((utils.get_device_name(), 0))
2020-01-22 19:50:57 +01:00
frame = b'\xff\xff\xff\xff\xff\xff' + utils.mac_address + b"\x60\x00" + "ZeusWPI is de max!".encode()
2020-01-21 03:27:35 +01:00
while True:
2020-01-22 19:43:45 +01:00
dt_string = datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")
print("Sending message")
sock.send(frame)
2020-01-21 03:27:35 +01:00
sleep(1)