Skip to content

Instantly share code, notes, and snippets.

@LifeIsHardd
Last active January 17, 2023 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LifeIsHardd/dfc323394322aad847fbdfd43d366a4f to your computer and use it in GitHub Desktop.
Save LifeIsHardd/dfc323394322aad847fbdfd43d366a4f to your computer and use it in GitHub Desktop.
idekCTF 2022* -- Manager Of The Year 1
from pwn import *
r = remote('manager-of-the-year-1.chal.idek.team', 1337)
r.sendlineafter(b'Press any key to continue...', b'')
rmse = []
# send 365 zero
r.sendlineafter(b'Enter your predictions for \'Revenue\' (in thousands) for 2023:\n',
' '.join(['0']*365).encode())
res = r.recvline().decode()
rmse.append(float(res.split('(')[1].split(')')[0]))
# send 364 zero and 1 "100"
# example0: 100 0 0 0...
# example1: 0 100 0 0...
for i in range(365):
to_send = ['0']*365
to_send[i] = '100'
r.sendlineafter(b'Enter your predictions for \'Revenue\' (in thousands) for 2023:\n',
' '.join(to_send).encode())
res = r.recvline().decode()
rmse.append(float(res.split('(')[1].split(')')[0]))
# calculate the correct value by using the RMSE formula
n = len(rmse) - 1 # 365
correct_value = []
for i in range(365):
correct_value.append(str(round(((rmse[i+1]**2 - rmse[0]**2) * n - 100**2) / -200, 2)))
r.recvuntil(b'Enter your predictions for \'Revenue\' (in thousands) for 2023:\n')
r.sendline(' '.join(correct_value).encode())
r.interactive()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment