OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
exabgp
/
bgp
/
message
/
update
/
attribute
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
2.11 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
__pycache__
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
aggregator.py
2.29 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
aigp.py
2.96 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
aspath.py
7.64 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
atomicaggregate.py
1.24 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
attribute.py
9.04 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
attributes.py
17.79 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
bgpls
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
clusterlist.py
1.65 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
community
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
generic.py
1.67 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
localpref.py
1.21 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
med.py
1.18 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
mprnlri.py
7.88 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
mpurnlri.py
3.58 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
nexthop.py
1.84 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
origin.py
1.78 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
originatorid.py
890 bytes
03/13/2021 04:30:48 PM
rw-r--r--
📄
pmsi.py
4.97 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
sr
-
03/16/2023 12:55:54 PM
rwxr-xr-x
Editing: aigp.py
Close
# encoding: utf-8 """ aigp.py Created by Thomas Mangin on 2013-09-24. 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 exabgp.util import ordinal from exabgp.util import character from exabgp.util import concat_bytes_i, concat_bytes from exabgp.bgp.message.update.attribute.attribute import Attribute # ========================================================================== TLV # # 0 1 2 3 # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # | Type | Length | | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | # ~ ~ # | Value | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+.......................... # Length: Two octets encoding the length in octets of the TLV, # including the type and length fields. class TLV(object): __slots__ = ['type', 'value'] def __init__(self, what, value): self.type = what self.value = value class TLVS(list): __slots__ = [] @staticmethod def unpack(data): def loop(data): while data: t = ordinal(data[0]) length = unpack('!H', data[1:3])[0] v, data = data[3:length], data[length:] yield TLV(t, v) return TLVS(list(loop(data))) def pack(self): return concat_bytes_i( concat_bytes(character(tlv.type), pack('!H', len(tlv.value) + 3), tlv.value) for tlv in self ) # ==================================================================== AIGP (26) # @Attribute.register() class AIGP(Attribute): ID = Attribute.CODE.AIGP FLAG = Attribute.Flag.OPTIONAL CACHING = True TYPES = [ 1, ] __slots__ = ['aigp', '_packed'] def __init__(self, aigp, packed=None): self.aigp = aigp if packed: self._packed = packed else: self._packed = self._attribute(aigp) def __eq__(self, other): return self.ID == other.ID and self.FLAG == other.FLAG and self.aigp == other.aigp def __ne__(self, other): return not self.__eq__(other) def pack(self, negotiated): if negotiated.neighbor.aigp: return self._packed if negotiated.local_as == negotiated.peer_as: return self._packed return b'' def __repr__(self): return '0x' + ''.join('%02x' % ordinal(_) for _ in self.aigp[-8:]) @classmethod def unpack(cls, data, negotiated): if not negotiated.neighbor.aigp: # AIGP must only be accepted on configured sessions return None return cls(unpack('!Q', data[:8] & 0x000000FFFFFFFFFF), data[:8])