Ejemplo n.º 1
0
class DefaultQueueControl(Process):
    def __init__(self, qi, qo):
        Process.__init__(self)
        self.dec = Decrypter()
        self.qi = qi
        self.qo = qo

    def run(self):
        self.plug = PluginManager()
        while True:
            x = self.qi.get()
            if x == None:
                self.qo.put(None)
                continue
            data, s, d = x
            # logger.warning(repr(data))
            # logger.warning("in: " + rev(data))
            mdata = (data,)
            if s == Connection.SERVER and data != b"\xaf\x01":
                mdata = self.dec.decrypt(data)
            for idata in mdata:
                for odata, src, dst in self.plug.act(d2_packet_parser[s].parse(idata), s, d):
                    odata = d2_packet_parser[src].build(odata)
                    if src == Connection.SERVER and data != b"\xaf\x01":
                        odata = encrypt(odata)
                    # logger.warning("out: " + rev(odata))
                    self.qo.put((odata, src, dst))
Ejemplo n.º 2
0
class DefaultQueueControl(Process):
    def __init__(self, qi, qo):
        Process.__init__(self)
        self.dec = Decrypter()
        self.qi = qi
        self.qo = qo

    def run(self):
        self.plug = PluginManager()
        while True:
            x = self.qi.get()
            if x == None:
                self.qo.put(None)
                continue
            data, s, d = x
            #logger.warning(repr(data))
            #logger.warning("in: " + rev(data))
            mdata = (data,)
            if s == Connection.SERVER and data != b"\xaf\x01":
                mdata = self.dec.decrypt(data)
            for idata in mdata:
                for odata, src, dst in self.plug.act(d2_packet_parser[s].parse(idata), s, d):
                    odata = d2_packet_parser[src].build(odata)
                    if src == Connection.SERVER and data != b"\xaf\x01":
                        odata = encrypt(odata)
                    #logger.warning("out: " + rev(odata))
                    self.qo.put((odata, src, dst))
Ejemplo n.º 3
0
 def __init__(self, qi, qo):
     Process.__init__(self)
     self.dec = Decrypter()
     self.qi = qi
     self.qo = qo
Ejemplo n.º 4
0
 def __init__(self, qi, qo):
     Process.__init__(self)
     self.dec = Decrypter()
     self.qi = qi
     self.qo = qo