LJ/ethertools/receivebroadcast.py

22 lines
416 B
Python
Raw Normal View History

2020-10-10 17:29:07 +00:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# -*- mode: Python -*-
# or tcpdump -i eth1 port 54545 -XX
import socket
def find_LJ():
"""Listen for broadcast packets."""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("0.0.0.0", 54545))
while True:
data, addr = s.recvfrom(1024)
print(" %s " % (data, ))
print("Packet from %s: " % (addr, ))
find_LJ()