frame-it/utils.py
2020-01-21 03:27:35 +01:00

22 lines
552 B
Python

import os
import netifaces
def get_device_name() -> str:
if 'INTERFACE' not in os.environ:
print("[Error] \"INTERFACE\" not found in your environment variables")
print(" Please specify your network interface")
exit(0)
return os.environ['INTERFACE']
def get_mac_address() -> bytes:
return bytes(list(map(lambda i: int(i, 16), netifaces.ifaddresses(
get_device_name())[netifaces.AF_LINK][0]["addr"].split(":"))))
mac_address = get_mac_address()
broadcast_address = b'\xff\xff\xff\xff\xff\xff'