PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/saltstack/salt/extras-3.10/pyroute2/netlink/uevent/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/saltstack/salt/extras-3.10/pyroute2/netlink/uevent/__init__.py

from pyroute2.netlink import NETLINK_KOBJECT_UEVENT, nlmsg
from pyroute2.netlink.nlsocket import Marshal, NetlinkSocket


class ueventmsg(nlmsg):
    pass


class MarshalUevent(Marshal):
    def parse(self, data, seq=None, callback=None):
        ret = ueventmsg()
        ret['header']['sequence_number'] = 0
        data = data.split(b'\x00')
        wtf = []
        ret['header']['message'] = data[0].decode('utf-8')
        ret['header']['unparsed'] = b''
        for line in data[1:]:
            if line.find(b'=') <= 0:
                wtf.append(line)
            else:
                if wtf:
                    ret['header']['unparsed'] = b'\x00'.join(wtf)
                    wtf = []

                line = line.decode('utf-8').split('=')
                ret[line[0]] = '='.join(line[1:])

        del ret['value']
        return [ret]


class UeventSocket(NetlinkSocket):
    def __init__(self):
        super(UeventSocket, self).__init__(NETLINK_KOBJECT_UEVENT)
        self.marshal = MarshalUevent()

    def bind(self):
        return super(UeventSocket, self).bind(groups=-1)