IPSC Logo

Internet Problem Solving Contest

IPSC 2018

Solution to Problem R – Raw data

The easiest way to be logged in is to use your browser to actually log in. This will create a session and store the session info in your browser’s cookies. You can then access these cookies and copy them out. (Depending on your browser, you might need to install an extension, but usually you can examine cookies in your privacy settings.

In our case, we got the cookies.txt file shown below. (The values in the last column have been truncated.)

# Netscape HTTP Cookie File
.ksp.sk TRUE    /   FALSE   1597233002  _ga GA1.2.1717...
ipsc.ksp.sk FALSE   /   FALSE   0   ipscsessid  8cbcdc...
ipsc.ksp.sk FALSE   /   FALSE   0   ipsc2018ann 3

You can then use some tool that will send a specific HTTP request to our webserver and tell it to include these cookies.

The two most commonly used tools for this job are the command-line tools wget and curl.

They can be used as follows:

wget --load-cookies=cookies.txt \
    https://ipsc.ksp.sk/2018/practice/problems/r2 --post-data=hello

curl --cookie cookies.txt --data hello https://ipsc.ksp.sk/2018/practice/problems/r2

The HTTP requests made by your browser contain many interesting fields that are not necessary for the bare communication. In particular, your browser identifies itself and its operating system to the webserver by sending a “User-Agent string”. These additional fields were used by our grader to make a heuristic guess whether you are using a browser or not. Thus, you could make the request to solve R2 also from your browser as long as you used its developer tools to alter/remove the User-Agent string it sends.