17 lines
384 B
Python
17 lines
384 B
Python
import fcntl
|
|
|
|
MAC_ADDRESS_SIZE = 6
|
|
DEVICE_PATH = "/dev/network_card_pci_driver_mac"
|
|
MY_IOCTL_GET_MAC_ADDRESS = 0xed696301
|
|
|
|
if __name__ == "__main__":
|
|
device_file = open(DEVICE_PATH, "rb")
|
|
|
|
mac_address_buffer = bytearray(MAC_ADDRESS_SIZE)
|
|
|
|
fcntl.ioctl(device_file, MY_IOCTL_GET_MAC_ADDRESS, mac_address_buffer)
|
|
|
|
print(mac_address_buffer.hex())
|
|
|
|
device_file.close()
|