OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python2.7
/
dist-packages
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/15/2022 06:13:41 AM
rwxr-xr-x
📁
Crypto
-
10/14/2020 08:39:38 AM
rwxr-xr-x
📄
README
119 bytes
07/01/2022 03:56:32 PM
rw-r--r--
📄
_ldb_text.py
3.48 KB
11/06/2015 01:30:18 PM
rw-r--r--
📄
_ldb_text.pyc
5.96 KB
03/26/2021 06:53:43 AM
rw-r--r--
📄
_tdb_text.py
3.28 KB
07/21/2015 08:32:32 PM
rw-r--r--
📄
_tdb_text.pyc
5.24 KB
10/14/2020 08:39:39 AM
rw-r--r--
📄
ldb.x86_64-linux-gnu.so
85.32 KB
03/24/2021 12:03:16 PM
rw-r--r--
📄
lsb_release.py
14.09 KB
08/07/2017 09:55:07 PM
rw-r--r--
📄
pycrypto-2.6.1.egg-info
666 bytes
04/03/2018 01:26:21 PM
rw-r--r--
📁
samba
-
02/03/2022 06:37:41 AM
rwxr-xr-x
📄
talloc.x86_64-linux-gnu.so
11.19 KB
11/09/2017 11:42:52 AM
rw-r--r--
📄
tdb.x86_64-linux-gnu.so
24 KB
10/26/2017 08:26:41 AM
rw-r--r--
Editing: _ldb_text.py
Close
# Text wrapper for ldb bindings # # Copyright (C) 2015 Petr Viktorin <pviktori@redhat.com> # Published under the GNU LGPLv3 or later import sys import functools import ldb def _recursive_encode(obj): if isinstance(obj, bytes): return obj elif isinstance(obj, str): return obj.encode('utf-8') else: return [_recursive_encode(o) for o in obj] class _WrapBase(object): @classmethod def _wrap(cls, wrapped): self = cls.__new__(cls) self._wrapped = wrapped return self def __len__(self): return len(self._wrapped) def __eq__(self, other): if hasattr(other, '_wrapped'): return self._wrapped == other._wrapped else: return self._wrapped == other def __ne__(self, other): if hasattr(other, '_wrapped'): return self._wrapped != other._wrapped else: return self._wrapped != other def __lt__(self, other): if hasattr(other, '_wrapped'): return self._wrapped < other._wrapped else: return self._wrapped < other def __le__(self, other): if hasattr(other, '_wrapped'): return self._wrapped >= other._wrapped else: return self._wrapped >= other def __gt__(self, other): if hasattr(other, '_wrapped'): return self._wrapped > other._wrapped else: return self._wrapped > other def __ge__(self, other): if hasattr(other, '_wrapped'): return self._wrapped >= other._wrapped else: return self._wrapped >= other def __repr__(self): return '%s.text' % repr(self._wrapped) class MessageElementTextWrapper(_WrapBase): """Text interface for a LDB message element""" def __iter__(self): for item in self._wrapped: yield item.decode('utf-8') def __getitem__(self, key): result = self._wrapped[key] if result is None: return None else: return result.decode('utf-8') @property def flags(self): return self._wrapped.flags @property def set_flags(self): return self._wrapped.set_flags _wrap_element = MessageElementTextWrapper._wrap class MessageTextWrapper(_WrapBase): """Text interface for a LDB message""" def __getitem__(self, key): result = self._wrapped[key] if result is None: return None else: return _wrap_element(result) def get(self, *args, **kwargs): result = self._wrapped.get(*args, **kwargs) if isinstance(result, ldb.MessageElement): return _wrap_element(result) elif isinstance(result, bytes): return result.decode('utf-8') else: return result def __setitem__(self, key, item): self._wrapped[key] = _recursive_encode(item) def __delitem__(self, key): del self._wrapped[key] def elements(self): return [_wrap_element(el) for el in self._wrapped.elements()] def items(self): return [(attr, _wrap_element(el)) for attr, el in self._wrapped.items()] @property def keys(self): return self._wrapped.keys @property def remove(self): return self._wrapped.remove @property def add(self): return self._wrapped.add @property def dn(self): return self._wrapped.dn @dn.setter def dn(self, new_value): self._wrapped.dn = new_value