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: message.py
Close
# encoding: utf-8 """ message.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) """ import socket from struct import unpack from collections import namedtuple from exabgp.netlink.attributes import Attributes from exabgp.netlink.netlink import NetLink class Message(object): # to be defined by the subclasses format = namedtuple('Parent', 'to be subclassed') DEFAULT_FLAGS = NetLink.Flags.NLM_F_REQUEST | NetLink.Flags.NLM_F_DUMP # to be defined by the subclasses class Header(object): PACK = '' LEN = 0 @classmethod def decode(cls, data): extracted = list(unpack(cls.Header.PACK, data[: cls.Header.LEN])) attributes = Attributes.decode(data[cls.Header.LEN :]) extracted.append(dict(attributes)) return cls.format(*extracted) @classmethod def extract(cls, format_type, control_flags=DEFAULT_FLAGS, family=socket.AF_UNSPEC, attributes=None): for data in NetLink.send(format_type, control_flags, family, attributes): yield cls.decode(data)