from pwn import *
p=remote('0', 9007)

p.recvuntil('Ready?')

for i in range(0, 100):
    print(i)
    p.recvuntil('N=')
    N=int(p.recvuntil(' ')[:-1])
    p.recvuntil('C=')
    C=int(p.recvline())
    L = 0
    R = N-1
    ctr = 0
    while L<=R:
        if L == R:
            p.sendline(str(L))
        else:
            mid = (L+R)//2
            payload = ""
            for i in range(L, mid+1):
                payload += str(i)+" "
            p.sendline(payload)
            result = int(p.recvline())
            if result == 10*(mid-L+1):
                L=mid+1
            else:
                R=mid

        if ctr == C:
            break
        ctr += 1

p.interactive()

Capture The Flag

image

'Writeup [pwn] > pwnable.kr' 카테고리의 다른 글

fd  (0) 2020.03.07
collision  (0) 2020.03.07
cmd2  (0) 2020.03.07
cmd1  (0) 2020.03.07
bof  (0) 2020.03.07

+ Recent posts