OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
pyroute2
/
ndb
/
objects
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/08/2024 06:42:21 PM
rwxr-xr-x
📄
__init__.py
37.07 KB
05/08/2024 06:42:21 PM
rw-r--r--
📁
__pycache__
-
05/08/2024 06:42:21 PM
rwxr-xr-x
📄
address.py
8.82 KB
05/08/2024 06:42:21 PM
rw-r--r--
📄
interface.py
35.24 KB
05/08/2024 06:42:21 PM
rw-r--r--
📄
neighbour.py
4.78 KB
05/08/2024 06:42:21 PM
rw-r--r--
📄
netns.py
1.93 KB
05/08/2024 06:42:21 PM
rw-r--r--
📄
route.py
28.21 KB
05/08/2024 06:42:21 PM
rw-r--r--
📄
rule.py
2.38 KB
05/08/2024 06:42:21 PM
rw-r--r--
Editing: netns.py
Close
import warnings from pyroute2 import netns from pyroute2.common import basestring from pyroute2.netlink.rtnl.nsinfmsg import nsinfmsg from pyroute2.requests.netns import NetNSFieldFilter from ..objects import RTNL_Object def load_nsinfmsg(schema, target, event): # # check if there is corresponding source # netns_path = event.get_attr('NSINFO_PATH') if netns_path is None: schema.log.debug('ignore %s %s' % (target, event)) return if schema.config['auto_netns']: warnings.warn( 'automatic netns sourcing is being refactored', DeprecationWarning ) schema.load_netlink('netns', target, event) schema = nsinfmsg.sql_schema().unique_index('NSINFO_PATH') init = { 'specs': [['netns', schema]], 'classes': [['netns', nsinfmsg]], 'event_map': {nsinfmsg: [load_nsinfmsg]}, } class NetNS(RTNL_Object): table = 'netns' msg_class = nsinfmsg table_alias = 'n' api = 'netns' field_filter = NetNSFieldFilter def __init__(self, *argv, **kwarg): kwarg['iclass'] = nsinfmsg self.event_map = {nsinfmsg: "load_rtnlmsg"} super(NetNS, self).__init__(*argv, **kwarg) @classmethod def spec_normalize(cls, processed, spec): if isinstance(spec, basestring): processed['path'] = spec path = netns._get_netnspath(processed['path']) # on Python3 _get_netnspath() returns bytes, not str, so # we have to decode it here in order to avoid issues with # cache keys and DB inserts if hasattr(path, 'decode'): path = path.decode('utf-8') processed['path'] = path return processed def __setitem__(self, key, value): if self.state == 'system': raise ValueError('attempt to change a readonly object') if key == 'path': value = netns._get_netnspath(value).decode('utf-8') return super(NetNS, self).__setitem__(key, value)