Description:
People either love or hate math. Do you love it? Prove it! You just need to solve a bunch of equations without a mistake.Solution:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Author: Kitwipat Towattana (@icheernoom) | |
from pwn import * | |
import sys | |
r = remote('188.166.133.53', 11027) | |
while True: | |
try: | |
result = r.recvline() | |
log.success(result) | |
problem = r.recvline() | |
question = problem.split(': ')[1] | |
log.info(problem) | |
x, cond, num1, eq, num2 = question.split(' ') | |
if "+" in cond: | |
ans = int(num2) - int(num1) | |
log.info("x = {0}".format(ans)) | |
r.send("{0}\r\n".format(ans)) | |
elif "-" in cond: | |
ans = int(num2) + int(num1) | |
log.info("x = {0}".format(ans)) | |
r.send("{0}\r\n".format(ans)) | |
elif "*" in cond: | |
ans = int(num2) / int(num1) | |
log.info("x = {0}".format(ans)) | |
r.send("{0}\r\n".format(ans)) | |
elif "/" in cond: | |
ans = int(num2) * int(num1) | |
log.info("x = {0}".format(ans)) | |
r.send("{0}\r\n".format(ans)) | |
except IndexError: | |
log.success("{0}".format(problem)) | |
sys.exit() | |
''' | |
root@kali:~/Desktop# python code50.py | |
[+] Opening connection to 188.166.133.53 on port 11027: Done | |
[+] Hi, I heard that you're good in math. Prove it! | |
[*] Level 1.: x + 10 = 23 | |
[*] x = 13 | |
[+] Yay, that's right! | |
[*] Level 2.: x + 24 = 63 | |
[*] x = 39 | |
...[snip]... | |
[*] Level 98.: x + 1259 = 1878 | |
[*] x = 619 | |
[+] Yay, that's right! | |
[*] Level 99.: x * 1945 = 643795 | |
[*] x = 331 | |
[+] Yay, that's right! | |
[*] Level 100.: x * 639 = 341865 | |
[*] x = 535 | |
[+] Yay, that's right! | |
[+] IW{M4TH_1S_34SY} | |
[*] Closed connection to 188.166.133.53 port 11027 | |
''' |
Flag: IW{M4TH_1S_34SY}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น