def test_http(self): for host in self.HTTP_HOSTS: f = Sock(host, 80) f.send("GET / HTTP/1.1\r\n\r\n") line = f.read_line().decode() self.assertTrue(line.startswith("HTTP/1.1 ")) f.close()
def test_http(self): for host in self.HTTP_HOSTS: f = Sock(host, 80) f.send("GET / HTTP/1.1\r\n\r\n") line = f.read_line() self.assertTrue(line.startswith("HTTP/1.1 ")) f.close()
so.send_line(str(pt[i]).encode()) assert int(so.read_line().strip().split(b' ')[-1]) in ct ''' p2 = gcd(pt[0] ** 2 - ct[0], pt[1] ** 2 - ct[1]) if 1024 < p2.bit_length() < 3072: p, t = gmpy2.iroot(p2, 2) if t: print(p) so.read_until(b'[Q]uit\n') so.send_line(b's') flag = int(so.read_line().strip().split(b' ')[-1]) pt = [random.getrandbits(2000) for _ in range(2)] ct = [] for i in range(2): so.read_until(b'[Q]uit\n') so.send_line(b'e') so.read_line() so.send_line(str(pt[i]).encode()) ct.append(int(so.read_line().strip().split(b' ')[-1])) pubkey = gcd(pt[0] ** 2 - ct[0], pt[1] ** 2 - ct[1]) if pubkey % (p ** 2) != 0: continue q = pubkey // (p ** 2) d = inverse(65537, (p - 1) * (q - 1)) m = pow(flag, d, p * q) if b'CCTF' in long_to_bytes(m): print(long_to_bytes(m)) break so.close()