def handle(self): data = recv_blob(self.request) msg = zlib.compress('user_data=%s;secret=%s' % (data, secret)) t = sum([random.randint(600,700) / 1000. for i in range(len(msg) / 300)]) time.sleep(t) send_blob(self.request, 'ok') return
def oracle(self, data): """ send 'data' to the oracle and retreived the compressed length """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) send_blob(s, data) data = recv_blob(s) s.close() return len(data)
def oracle(self, data): """ send 'data' to the oracle and calculate the time it takes to get a response. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) t = time.time() send_blob(s, data) data = recv_blob(s) t = (time.time() - t) s.close() #print repr(t * 1000) # The pivot value "600" was manually determined after observing # the behavior of the vulnerable server. return int((t * 1000) / 600)
def handle(self): data = recv_blob(self.request) msg = zlib.compress('user_data=%s;secret=%s' % (data, secret)) send_blob(self.request, encrypt(msg)) return
def handle(self): data = recv_blob(self.request) msg = zlib.compress('user_data=%s;secret=%s' % (data, secret)) self.request.send(struct.pack('<I', len(msg))) return