defcheck_ans(_N, _x) -> bool: check = 0 for i inrange(len(_N)): check += _N[i] * _x[i] return check == 0
defmain(): ifnot proof_of_work(): return print("Welcome to MRCTF2021, enjoy this friendly sign-in question~") flag_bits = bin(bytes_to_long(flag.encode()))[2:] N = [getPrime(Bits) for _ inrange(length)] print('N =', N) X = [] for i inrange(length): x = [int(input().strip()) for _ inrange(length)] if x in X: print('No cheat!') return if x.count(0) > 0: print('No trivial!') return ifnot check_ans(N, x): print('Follow the rule!') return X.append(x) print('your gift:', flag_bits[i])
text = path.recvline().decode() tem = text.split('"') print(text) path.sendline(sign_in(tem[1])) text = path.recvline() text = path.recvline().decode().split(",") text[0] = text[0][5:] text[-1] = text[-1][:-2] sum = 1 lib = [] for i inrange(length): lib.append(int(text[i]))
flag_bin = '' for j inrange(length-1): #此处的-1是因为做满224次后会因为223次输出后就断开连接而报错 path.sendline(str(0 - (j + 1) * lib[1]).encode()) path.sendline(str((j + 1) * lib[0]).encode()) for i inrange(2, length): if i % 2 == 0: path.sendline(str(0 - lib[i + 1]).encode()) if i % 2 == 1: path.sendline(str(lib[i - 1]).encode()) text = path.recvline().decode() print(text) flag_bin = flag_bin + text[-2:-1] print(flag_bin)
flag = long_to_bytes(int(flag_bin, 2)) print(flag)