python-sock-raw/sock-raw.py
2024-06-03 14:50:31 +02:00

14 lines
270 B
Python

import socket
s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW)
s.bind(("wlp3s0", 0))
src_addr = 0xffffffffffff
dst_addr = 0xffffffffffff
ethertype = 0x1337
packet = dst_addr.to_bytes(6) + src_addr.to_bytes(6) + ethertype.to_bytes(2)
print(packet)
s.send(packet)