connecting to server and sending data to it in python
<p>I have a server address that I can connect to it through netcat. when I connect to the server through terminal the server gives me 3 random numbers each one is in it's own line. what I have to do is to multiply the first two numbers (first two lines) and divide them by the third number and I only have 0.1 seconds to do that (or more), so I have written a script which strip each line from the new line char and set it to a string then it will be converted to an integer so I can do the math and send the value I get to the server. So my code is this</p>

<pre><code>import socket


adib = socket.socket()

host = 'services.cyberprotection.agency'

port = 9999


adib.connect((host, port))

naruto = adib.recv(1024)

if '\n' in naruto:
    line1, naruto = naruto.split('\n', 1)
    if '\n' in naruto:
        line2, naruto = naruto.split('\n', 1)
        if '\n' in naruto:
            line3, naruto = naruto.split('\n', 1)


akagami = int(line1) * int(line2) / int(line3)



print adib.sendall(str(akagami))




adib.close()
</code></pre>

<p>I don't know how to send the value of <code>akagami</code> or at least see the answer I get from sending the value, because I will get a flag after sending the value of <code>akagami</code>, I have tried <code>os.system</code> but connecting through terminal gives different values than connecting through socket so the value of the three numbers change each time a new connection is set. Also I can't conrol the server</p>