60 lines
2.3 KiB
Markdown
60 lines
2.3 KiB
Markdown
# SUTOM
|
|
|
|
My family plays the game [SUTOM](https://sutom.nocle.fr/#) all the time now.
|
|
|
|
It is like fashion. but worse.
|
|
|
|
So, since I'm very bad at this game, I've decided to find a way to beat all of them every time.
|
|
|
|
And to do that, I just have to find the word first, with the fewer tries.
|
|
|
|
Easy.
|
|
|
|
## Rules
|
|
The objective of the game is to try different words, and every time, the game will answer by telling you what letters are correct.
|
|
If a letter can be in the word and at the correct place, in the word and **not** at the correct place, or simply not in the word.
|
|
|
|
To win the game, you have to find the word before exhausting all of your tries (you have 6 of them).
|
|
|
|
And to rank the players, you look at their completion time and the number of tries it took them to find the word.
|
|
|
|
So... let's win this game with only one shot!!
|
|
|
|
## The Akinator of Sutom
|
|
I first look at the website and searched for the source code.
|
|
|
|
After looking around, it is clear that Javascript is used to make the game work.
|
|
And that no obfuscation technique were used.
|
|
|
|
So, after some time reading through the source code, I found an interesting function called `verifierMot`.
|
|
I guess I'm on the right path.
|
|
|
|
And sure enough, I came accross the very interesting property: `this._motATrouver`.
|
|
This is juicy :)
|
|
|
|
Now the rest is just to understand how I can access this variable, and print it to the console :D
|
|
|
|
To do so, I've noticed that nothing is accessible from the global scope.
|
|
And the code is importing modules like NodeJS. First time I see this.
|
|
|
|
I quickly find that it is using the module [`requirejs`](https://requirejs.org/docs/start.html).
|
|
And after searching a bit on the Internet to understand how I can access the variables defined inside the modules, I made the following code:
|
|
|
|
```js
|
|
requirejs(['gestionnaire'], function(ge) {let g = new ge.default();setTimeout(function() {console.log(g._motATrouver)}, 1000);});
|
|
```
|
|
|
|
And voilà:
|
|
|
|

|
|
|
|
The timeout is because the object don't seem to be populated when called, but some time after.
|
|
I guess there is a better way to access the properties after they were loaded, but I didn't want to spend too much time on this.
|
|
|
|
So that's it.
|
|
|
|
We can read the word of the day in the console, and solve this Sutom with only 1 try.
|
|
Enjoy! x)
|
|
|
|
@rainfall
|