47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
from pwn import * # type: ignore
|
|
# context.log_level = 'debug'
|
|
|
|
"""
|
|
(这题小小的放了水)
|
|
因为只有一轮,而最终的答案有128种情况,那我们不妨直接猜一个答案
|
|
根据条件概率公式算一下
|
|
|
|
for i in range(0,1000,100):
|
|
print(i,":", 1 - (127/128) ** i)
|
|
|
|
0 : 0.0
|
|
100 : 0.5435690025908804
|
|
200 : 0.7916707446041162
|
|
300 : 0.9049120701701576
|
|
400 : 0.9565989213461966
|
|
500 : 0.9801904023814129
|
|
600 : 0.990958285600675
|
|
700 : 0.9958730812784277
|
|
800 : 0.9981163463716863
|
|
900 : 0.9991402420956556
|
|
大概300次以内都出结果了
|
|
"""
|
|
|
|
|
|
|
|
for i in range(300):
|
|
try:
|
|
r = remote("localhost", 10011)
|
|
# r = process(['python3', 'main.py'])
|
|
for i in range(15):
|
|
r.sendlineafter(b":", b"1")
|
|
r.recvuntil(b"!")
|
|
|
|
r.sendlineafter(b"chests:", b"0 0 1 0 0 1 0")
|
|
r.recvline()
|
|
flag = r.recvline()
|
|
if b"flag" in flag:
|
|
end_time = time.time()
|
|
print(flag)
|
|
break
|
|
else:
|
|
r.close()
|
|
|
|
except EOFError:
|
|
pass
|