本文最后更新于 680 天前,其中的信息可能已经有所发展或是发生改变。
S3qUenCEs
payload
from pwn import *
def run(n: int, m: int, a1: list):
sign = []
minn = []
summary = 0
sum1 = 0
sum2 = 0
for i in range(m):
a = int(a1[i])
sign.append(1)
if a < 0:
sign[i] *= -1
a *= -1
summary += a
minn.append(a)
for i in range(n-m):
a = int(a1[i+m])
if a < 0:
sign[i % m] *= -1
a *= -1
summary += a
if a < minn[i % m]:
minn[i % m] = a
for i in range(m):
if sign[i] > 0:
sum1 += minn[i]
else:
sum2 += minn[i]
return summary-2*min(sum1, sum2)
pro = remote('172.52.4.26', 9999)
for i in range(100):
print(f'round: {i}')
b = pro.recvuntil(b'Give me your output:\n').decode().split('\n')[-4:-2]
print(b)
_len = int(b[0].split()[0])
k = int(b[0].split()[1])
a1 = b[1].split()
print(_len, k, len(a1))
answer = run(_len, k, a1)
print(answer)
pro.sendline(str(answer).encode())
pro.interactive()
from pwn import *
from pwnlib.util.iters import mbruteforce
from hashlib import sha256
def proof_of_work(sh):
sh.recvuntil("XXXX + ")
suffix = sh.recvuntil(')').decode("utf8")[:-1]
log.success(suffix)
sh.recvuntil("== ")
cipher = sh.recvline().strip().decode("utf8")
proof = mbruteforce(lambda x: sha256((x + suffix).encode()).hexdigest() == cipher, string.ascii_letters + string.digits, length=4, method='fixed')
sh.sendlineafter("Give me XXXX:", proof)
sh=remote("123.57.1.42","29518")
proof_of_work(sh)
sh.interactive()