commit fc32c5046322cf6527999c5b3dbc0ce65c3eb586 Author: Noa Date: Wed Mar 2 20:41:30 2022 +0100 First commit diff --git a/blog/sutom.md b/blog/sutom.md new file mode 100644 index 0000000..fe2be06 --- /dev/null +++ b/blog/sutom.md @@ -0,0 +1,59 @@ +# 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Ă : + +![Sutom Win](./sutom/sutom_win.png) + +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 diff --git a/blog/sutom/sutom_win.png b/blog/sutom/sutom_win.png new file mode 100644 index 0000000..55a6943 Binary files /dev/null and b/blog/sutom/sutom_win.png differ diff --git a/tools/.empty b/tools/.empty new file mode 100644 index 0000000..e69de29