50 InternetWache2016 Code50



Badly coded answer for a bad ctf challenge. Was joking with someone that I refuse to use loops for my answers lmao. Neverthe less it worked.

from pwn import *  
from bs4 import BeautifulSoup  
import requests  
from sympy import *

#sympy setup

x, y, z, t = symbols('x y z t')

#equation
equation = ""

url = "188.166.133.53"  
port= 11027

##Create a session for
session = requests.Session()

conn = remote("188.166.133.53", "11027")  
print conn.recvline()

def findAnswer():

    print conn.recvuntil(": ")
    expression = conn.recvline()
    print expression

    expression = expression.strip()

    answer =  expression.split('=')
    print answer
    if int(answer[1]) != 0:
        ##add the beginning part plus the minus of the answer
        equation = answer[0] + "- " + str( int(answer[1]))
        print equation

    set = solve(equation, x)
    set = str(set[0])
    print set
    conn.send(set)
    print conn.recvline()

##should of used a loop lmao 
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
findAnswer()  
## 1oo iterations

print conn.recvline()  
#print conn.recvline()


##get the content for the page
#page = conn.content

#beaufitufl soup initialize
#soup= BeautifulSoup(page)

#response = soup.prettify()

#print response
Press ` to check out my sick terminal!