# Hacktivity basic puzzle: Math in 3 seconds

## The puzzle from Hacktivity

Here is a basic level puzzle from Hacktivity: you have to solve an equation in 3 seconds. This sounds pretty easy until you see the equation itself. 🙂

The equations are randomly generated and you have 3 seconds to enter the result in the box below (as you can see on the image):

## First try

My first thought was to be fast 🙂 and put the equation in Wolfram|Alpha, get the result (which is calculated by Wolfram around 3 secs by itself) and put it in the input field. This method gave me a *Timeout* response, whereas an invalid number resulted a *fail* response. Hm..

I thought about parsing the equation, sending it to Wolfram and putting back the result in the form box but that solution would require a lot of time and I knew that this isn’t the optimal way of “hacking” this puzzle.

## Second try

After a bit of struggling, I noticed that all of the solutions for the ever-changing equations are coming from the number range of approx. 1-100. Sometimes two different equations had the same solution. This made me create this little script:

1 2 3 |
curl --cookie "PHPSESSID=7hk9ffu1dbe4f02p33b53ftve7" http://172.16.3.246/level10/ > /dev/null sleep 1 curl --cookie "PHPSESSID=7hk9ffu1dbe4f02p33b53ftve7" --form "math[solution]=8" http://172.16.3.246/level10/ |

First, get the equations as it would be normal. Then wait a bit (we are simulating a human, right?) and send a possible result which is in this case is 8. And voilá, after a couple of failed attempts the result and the equation finally matched and I got the code. 🙂