from setflag import set_flag
from getflag import get_flag
from exploit import exploit
from benign import benign

flag = 'test'
ip = '192.168.1.101'
port = '20130'
benign(ip, port)
resp = set_flag(ip, port, flag)
legit_flag = get_flag(ip, port, resp['FLAG_ID'], resp['TOKEN'])['FLAG']
if flag != legit_flag:
    raise Exception('Legit flag is wrong! flag: ' + flag + ' legit: ' + legit_flag)
exploit_flag = exploit(ip, port, resp['FLAG_ID'])['FLAG']
print exploit_flag
if flag != exploit_flag:
    raise Exception('Exploit flag is wrong! flag: ' + flag + ' exploit: ' + exploit_flag)
