from pwn import * import string import hashlib context.log_level = 'debug' sh = remote("39.96.90.217","17497") sh.recvuntil("x[:20] = ") pa = sh.recv(len('f91a551dfa31e47458df')) sh.recvuntil('openssl_sha') fun = sh.recvuntil(">")[:-1] sh.recvuntil("> ") table = string.printable defgetpow(fun,mess): for i in table: for j in table: for k in table: for l in table: password=i+j+k+l if fun == "256": if hashlib.sha256(password.encode()).hexdigest()[:20] == mess: return i+j+k+l elif fun == "384": if hashlib.sha384(password.encode()).hexdigest()[:20] == mess: return i+j+k+l elif fun == "1": if hashlib.sha1(password.encode()).hexdigest()[:20] == mess: return i+j+k+l elif fun == "512": if hashlib.sha512(password.encode()).hexdigest()[:20] == mess: return i+j+k+l elif fun == "224": if hashlib.sha224(password.encode()).hexdigest()[:20] == mess: return i+j+k+l else: print(fun) else: print("no ans") sh.sendline(getpow(fun,pa)) sh.interactive()
然乎我们输入token,拿到自己的data,解得ek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
from Crypto.Util.number import * from gmpy2 import * n1 = n2= p = gcd(n1,n2) q1 = n1//p q2 = n2//p assert n1 == p*q1 assert n2 == p*q2 c1 = e = 65537 phi = (p-1)*(q2-1) d = inverse(e,phi) m = pow(c2,d,n2) print(long_to_bytes(m)) >>>愿我所爱无忧恙岁长安