Tunnel ethernet over EVERYTHING!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helper.py 511B

123456789101112131415161718192021222324
  1. def getSrcMacFromPkt(packet):
  2. if len(packet) < 16:
  3. return None
  4. return packet[10:16]
  5. def getDstMacFromPkt(packet):
  6. if len(packet) < 10:
  7. return None
  8. return packet[4:10]
  9. def binToHexStr(binmac):
  10. return "".join(["%02x" % ord(i) for i in binmac])
  11. # checks if packet is a broadcast packet
  12. def isBroadcast(packet):
  13. binmac = getDstMacFromPkt(packet)
  14. # normal broadcast
  15. if binmac == '\xff\xff\xff\xff\xff\xff':
  16. return True
  17. # v6 multicast
  18. if binmac.startswith('\x33\x33'):
  19. return True
  20. return False