hsrp.py 475 B

12345678910111213141516171819202122232425262728293031
  1. """Cisco Hot Standby Router Protocol."""
  2. from pypacker import pypacker
  3. # Opcodes
  4. HELLO = 0
  5. COUP = 1
  6. RESIGN = 2
  7. # States
  8. INITIAL = 0x00
  9. LEARN = 0x01
  10. LISTEN = 0x02
  11. SPEAK = 0x04
  12. STANDBY = 0x08
  13. ACTIVE = 0x10
  14. class HSRP(pypacker.Packet):
  15. __hdr__ = (
  16. ("version", "B", 0),
  17. ("opcode", "B", 0),
  18. ("state", "B", 0),
  19. ("hello", "B", 0),
  20. ("hold", "B", 0),
  21. ("priority", "B", 0),
  22. ("group", "B", 0),
  23. ("rsvd", "B", 0),
  24. ("auth", "8s", b"cisco"),
  25. ("vip", "4s", b"")
  26. )