Exemple #1
0
 def parse_encrypted_stream(self, bytestream):
     plaintext = self.decipher.decrypt(bytestream)
     self.opposite_proxy_side.protocol.sendData(plaintext)
     data = self.leftover + plaintext
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(self.mgsside, parsed_packets,
                               encrypted=True, leftover=self.leftover)
Exemple #2
0
 def parse_encrypted_stream(self, bytestream):
     plaintext = self.decipher.decrypt(bytestream)
     self.opposite_proxy_side.protocol.sendData(plaintext)
     data = self.leftover + plaintext
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(self.mgsside,
                               parsed_packets,
                               encrypted=True,
                               leftover=self.leftover)
Exemple #3
0
 def parse_stream(self, bytestream):
     data = self.leftover + bytestream
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(
         self.mgsside, parsed_packets, leftover=self.leftover)
     for p in parsed_packets:
         if p[0] == 253:
             self.on_encryption_key_request(p[1])
             self.factory.proxyclient.protocol.send_encryption_key_request(
                 p[1])
         elif p[0] == 252:
             """ STEP 4: initiate encryption on both side. """
             self.factory.proxyclient.protocol.sendData(data)
             self.start_encryption()
             self.factory.proxyclient.protocol.start_encryption()
         elif p[0] == 254:
             self.factory.proxyclient.protocol.sendData(data)
         elif p[0] == 255:
             self.factory.proxyclient.protocol.sendData(data)
         else:
             log.msg("packet %d cannot be unencrypted" % p[0])
Exemple #4
0
 def parse_stream(self, bytestream):
     if self.proxyserver.protocol is None:
         self.log.msg(
             "Not having connection to server yet, postpone proxying")
         self.leftover += bytestream
         return
     data = self.leftover + bytestream
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(
         self.mgsside, parsed_packets, leftover=self.leftover)
     for p in parsed_packets:
         if p[0] == 252:
             self.on_encryption_key_responce(p[1])
             self.proxyserver.protocol.send_encryption_key_response()
         elif p[0] == 2:
             self.proxyserver.protocol.send_handshake(p[1])
         elif p[0] == 254:
             self.proxyserver.protocol.sendData(data)
         elif p[0] == 255:
             self.proxyserver.protocol.sendData(data)
         else:
             log.msg("packet %d cannot be unencrypted" % p[0])
Exemple #5
0
 def parse_stream(self, bytestream):
     data = self.leftover + bytestream
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(self.mgsside,
                               parsed_packets,
                               leftover=self.leftover)
     for p in parsed_packets:
         if p[0] == 253:
             self.on_encryption_key_request(p[1])
             self.factory.proxyclient.protocol.send_encryption_key_request(
                 p[1])
         elif p[0] == 252:
             """ STEP 4: initiate encryption on both side. """
             self.factory.proxyclient.protocol.sendData(data)
             self.start_encryption()
             self.factory.proxyclient.protocol.start_encryption()
         elif p[0] == 254:
             self.factory.proxyclient.protocol.sendData(data)
         elif p[0] == 255:
             self.factory.proxyclient.protocol.sendData(data)
         else:
             log.msg("packet %d cannot be unencrypted" % p[0])
Exemple #6
0
 def parse_stream(self, bytestream):
     if self.proxyserver.protocol is None:
         self.log.msg(
             "Not having connection to server yet, postpone proxying")
         self.leftover += bytestream
         return
     data = self.leftover + bytestream
     parsed_packets, self.leftover = parse_packets(data)
     processor.process_packets(self.mgsside,
                               parsed_packets,
                               leftover=self.leftover)
     for p in parsed_packets:
         if p[0] == 252:
             self.on_encryption_key_responce(p[1])
             self.proxyserver.protocol.send_encryption_key_response()
         elif p[0] == 2:
             self.proxyserver.protocol.send_handshake(p[1])
         elif p[0] == 254:
             self.proxyserver.protocol.sendData(data)
         elif p[0] == 255:
             self.proxyserver.protocol.sendData(data)
         else:
             log.msg("packet %d cannot be unencrypted" % p[0])