Beispiel #1
0
 def encodePacket(self, addr, data):
   sessionKey=self.makeSession(addr, True)
   if not sessionKey:
     print('Unknown address', addr, 'trying introduction...')
     sessionKey=self.introducer.makeIntroduction(addr, self.sock)
     if not sessionKey:
       print('Introduction failed.')
       return
   packet=DataPacket()
   packet.createDataPacket(sessionKey, data, self.keys.entropy)
   return packet
Beispiel #2
0
 def encodePacket(self, addr, data):
     sessionKey = self.makeSession(addr, True)
     if not sessionKey:
         print('Unknown address', addr, 'trying introduction...')
         sessionKey = self.introducer.makeIntroduction(addr, self.sock)
         if not sessionKey:
             print('Introduction failed.')
             return
     packet = DataPacket()
     packet.createDataPacket(sessionKey, data, self.keys.entropy)
     return packet