/usr/lib/python2.7/dist-packages/dpkt/vrrp.py is in python-dpkt 1.8.r98-0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # $Id: vrrp.py 88 2013-03-05 19:43:17Z andrewflnr@gmail.com $
"""Virtual Router Redundancy Protocol."""
import dpkt
class VRRP(dpkt.Packet):
__hdr__ = (
('vtype', 'B', 0x21),
('vrid', 'B', 0),
('priority', 'B', 0),
('count', 'B', 0),
('atype', 'B', 0),
('advtime', 'B', 0),
('sum', 'H', 0),
)
addrs = ()
auth = ''
def _get_v(self):
return self.vtype >> 4
def _set_v(self, v):
self.vtype = (self.vtype & ~0xf) | (v << 4)
v = property(_get_v, _set_v)
def _get_type(self):
return self.vtype & 0xf
def _set_type(self, v):
self.vtype = (self.vtype & ~0xf0) | (v & 0xf)
type = property(_get_type, _set_type)
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
l = []
for off in range(0, 4 * self.count, 4):
l.append(self.data[off:off+4])
self.addrs = l
self.auth = self.data[off+4:]
self.data = ''
def __len__(self):
return self.__hdr_len__ + (4 * self.count) + len(self.auth)
def __str__(self):
data = ''.join(self.addrs) + self.auth
if not self.sum:
self.sum = dpkt.in_cksum(self.pack_hdr() + data)
return self.pack_hdr() + data
|