Skip to content

[Challenge 2] Tux

Justin Chadwell edited this page Oct 23, 2020 · 2 revisions

We get a challenge file this time, level1.stl, as well as this description:

Down the rabbit hole! I think this is bigger than we thought!

Following on from your findings, I came across this message with a file attached:

Gaming is awesome! I love games so much I've started to make a few levels
for one of my favourites!

The level's not quite done, but I think it's still really really fun.

Could you take a look?

Before we can do anything, let's try and work out what kind of file we're looking at. Let's use the file utility on Linux to get some idea of what we're looking at:

$ file level1.stl
level1.stl: ASCII text

So this is a text file. Before looking at the contents, let's the other piece of information, the file extension. If we search for the .STL file extension, we're quickly led to information on the 3D file format STL.

Reading down, we can see there are two variants, Binary and ASCII variants. Since our file is an ASCII file, we can see that the file should begin with the line solid <name>. Looking at the first few lines of the file (using the head utility) though, we can see that this isn't the case:

$ head level1.stl
(supertux-level
  (version 3)
  (name (_ "Level 1"))
  (author "SuperTux Player")
  (license "CC-BY-SA 4.0 International")
  (sector
    (name "main")
    (ambient-light
      (color 1 1 1)
    )

So this is clearly not a 3D file! But, that first line ties into the description - it it appears to be a level for the game SuperTux!

Let's download a copy of the game from the website (or your package manager if you're on Linux).

From the menu it's not very clear how to load a level! However, the game has a builtin level-editor! So we can create a level, find where that file is saved, and then replace that level with our own!

Let's open the Level Editor, and select the option to create a new world:

Now let's give our world a distinctive name:

Then we can create a level in our world:

And immediately press "Escape" to save the world and exit.

Now, let's go looking for this saved file. On Linux, program data is usually stored in:

  • ~/.programname
  • ~/.config/programname
  • ~/.local/share/programname

or a combination of the above.

After looking through those, we can find our level!

$ ls .local/share/supertux2/levels/findme
info  level1.stl

There's even a level1.stl file - so let's replace that with the downloaded file.

Then let's open up the level in the level editor! We can see it's loaded successfully:

We can scroll around with the arrow keys, but we can't find anything...

After playing around a bit we click on the "Sector: main" button in the bottom left, and open a dialogue:

This reveals the flag spelled out in blocks!

Taking down each letter, reveals the flag "HTM{EPIC_PENGUIN}".

Manual file analysis

It was possible to solve this challenge in an entirely different way, just by looking through the file and not downloading any more pieces of software!

If we look through the STL file, we can see a reference to a flag:

...
  (sector
    (name "flag")
    (ambient-light
      (color 1 1 1)
    )
...

That means there's a flag somewhere in the file which we should be able to extract.

In this section, we can see lots of repeated blocks of code, some "bricks":

...
    (brick
      (x 64)
      (y 288)
      (breakable #t)
    )
...

At each of these locations, we'll get a brick, so let's extract the coordinates into a list (preferably using macros in a powerful text editor like vim).

64 288
64 320
64 352
64 384
64 416
64 448
64 480
...

Then we can use a tool like gnuplot to plot the points:

$ gnuplot
gnuplot> set yrange [* : *] reverse
gnuplot> plot "map.dat" using 1:2 pt 7 ps 5

Then we can resize the output window to see the flag:

Clone this wiki locally