0xGame2021-第四周
B21031423-Schen-第4周wp
Crypto boom
有个傻逼把位运算>>16当成以16进制输出了我不说他是谁
因为>>16了所以我们先<<16再加上range(2**16)进行爆破
代码略 因为我删了
然后把最后的密文long_to_bytes一下
准备工作就好了开始解
from Crypto.Util.number import*
#有时候可以从题目里白嫖一下就可以少敲好多东西
class LCG:
def __init__(self):
self.a = 2223895827
self.b = 2180283007
self.m = 3462137369
self.seed = 141729313
def next(self):
self.seed = (self.a * self.seed + self.b) % self.m
return self.seed >> 16
lcg=LCG()
flag=""
s="5|AgnezAf|kltbrl_[fwp=ah]oqYwq0nrkt"
for j in range(35):
k=lcg.next() % 10
for i in range(200):
c = chr(i ^ k)
if c==s[j]:
flag+=chr(i)
print(flag)
Crypto ezEcc
菜鸡思路:
爆破出k解出flag
p=14050339
a=1
b=3243167
E = EllipticCurve(GF(p),[a,b])
G=E(7112688,7410262)
for k in range(G.order()):
if k%1000==0:
print(k)
if k*G==E(6562993 , 2753874):
print(k)
break
p=14050339 a=1 b=3243167 k =4282465 E = EllipticCurve(GF(p),[a,b]) c1 = E(3095063 , 1465594) c2 = E(6437074 , 4385056) m = c1-k*c2 print(m)
最终m为12050118 : 14050303
翻译一下就是learnecc
0xGame{learnecc}
Crypto ParityOracleBase5
这道题....我也不知道该怎么讲....
from pwn import*
from Crypto.Util.number import*
io=remote("47.101.38.213", 60713)
io.recvuntil(b"4.Quit\n",drop=False)
io.sendline(b"1")
io.recvuntil(b"n=",drop=False)
n=int(io.recvline(keepends=False))
io.recvuntil(b"e=",drop=False)
e=int(io.recvline(keepends=False))
io.recvuntil(b"c=",drop=False)
c=int(io.recvline(keepends=False))
l,r=0,n
t=1
while l<r:
if t%30==0:
print(t,r-l)
d=(r-l)//5
io.recvuntil(b">",drop=False)
io.sendline(b"3")
io.recvuntil(b">",drop=False)
io.sendline(str(pow(5,t*e%n,n)*c%n).encode())
io.recvuntil(b": ",drop=False)
k=int(io.recvline())
if k==0:
r=l+d
elif k==1:
l,r=l+d,l+2*d
elif k==2:
l,r=l+2*d,l+3*d
elif k==3:
l,r=l+3*d,l+4*d
elif k==4:
l+=4*d