import time
from pwn import *
HOST = 'pwnable.kr'
PORT = 9007
conn = remote(HOST, PORT)
time.sleep(3)
#coin
print conn.recv()
for i in range(0,100):
conn.recvuntil('N=')
n = int(conn.recvuntil(' '))
conn.recvuntil('C=')
c = int(conn.recv())
print n, c
start = 0
end = n
msg = ""
while(start<=end):
msg = ""
mid = (start + end ) / 2
#check the binary search for counterfeit
print "([+] sending msg ... )"
for i in range(start, mid+1):
msg += str(i) + " "
msg += '\n'
conn.send(msg)
print msg
dt = conn.recvline()
if(dt.find("Correct") != -1):
break;
weight = int(dt)
if(weight % 10 == 0):
print "[+] counterfeit not found"
start = mid + 1
elif(weight % 10 != 0):
print "[+] counterfeit found"
end = mid
print "counterfeit has been found"
print conn.recv(2014)
---추후 다시 고쳐서 --
'[ ★ ]Study > War Game' 카테고리의 다른 글
[Rookiss] pwnable.kr fsb (0) | 2018.10.09 |
---|---|
[Toddler's Bottle] pwnable.kr blukat (0) | 2018.08.13 |
[Toddler's Bottle] pwnable.kr unlink 풀이 (0) | 2017.09.17 |
[Toddler's Bottle] pwnable.kr memcpy 풀이 (0) | 2017.09.16 |
[Toddler's Bottle] pwnable.kr asm 풀이 (0) | 2017.09.16 |
댓글