OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
exabgp
/
netlink
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
__init__.py
1.83 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
__pycache__
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
attributes.py
1.6 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
firewall.py
2.72 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
message.py
1.12 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
netlink.py
5.61 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
old.py
24.49 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
route
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
sequence.py
357 bytes
03/13/2021 04:30:48 PM
rw-r--r--
📄
tc.py
1.63 KB
03/13/2021 04:30:48 PM
rw-r--r--
Editing: attributes.py
Close
# encoding: utf-8 """ attributes.py Created by Thomas Mangin on 2015-03-31. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ from struct import pack from struct import unpack from struct import calcsize from exabgp.util import concat_bytes_i from exabgp.netlink import NetLinkError class AttributesError(NetLinkError): pass class Attributes(object): class Header(object): PACK = 'HH' LEN = calcsize(PACK) class Type(object): IFA_UNSPEC = 0x00 IFA_ADDRESS = 0x01 IFA_LOCAL = 0x02 IFA_LABEL = 0x03 IFA_BROADCAST = 0x04 IFA_ANYCAST = 0x05 IFA_CACHEINFO = 0x06 IFA_MULTICAST = 0x07 @classmethod def decode(cls, data): while data: length, atype, = unpack(cls.Header.PACK, data[: cls.Header.LEN]) if len(data) < length: raise AttributesError("Buffer underrun %d < %d" % (len(data), length)) payload = data[cls.Header.LEN : length] yield atype, payload data = data[int((length + 3) / 4) * 4 :] @classmethod def encode(cls, attributes): def _encode(atype, payload): def pad(length, to=4): return (length + to - 1) & ~(to - 1) length = cls.Header.LEN + len(payload) raw = pack(cls.Header.PACK, length, atype) + payload pad = pad(length) - len(raw) if pad: raw += b'\0' * pad return raw return concat_bytes_i(_encode(k, v) for (k, v) in attributes.items())