> For the complete documentation index, see [llms.txt](https://writeups.ayweth20.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://writeups.ayweth20.com/2023/404ctf-2023/retro-ingenierie/linspiration-en-images.md).

# L'Inspiration en images

**Catégorie:** Retro Ingénierie - **Difficulté:** Facile

{% file src="/files/CR2kdBzVLVwbZb0AA2EO" %}

**Description:**

<figure><img src="/files/D0u2ezyzSf2bxX8j5l0m" alt=""><figcaption></figcaption></figure>

**Solution:**

Pour ce challenge de reverse, nous devons trouver un élément se rapportant à une couleur *rgba*.

Pour commencer, nous allons décompiler le programme avec Ghidra afin de pouvoir regarder et inspecter les fonctions :&#x20;

<figure><img src="/files/SBpOGBmZ5pUFtNTmoSsj" alt="" width="120"><figcaption></figcaption></figure>

Commençons (comme toujours) par analyser la fonction *main*.\
En regardant son code, nous remarquons très rapidement une partie avec le terme *`glad_glClearColor`* suivi de 4 valeurs qui sont surement nos valeurs rgba :&#x20;

<figure><img src="/files/wlaJtiktcexp06U0vJp5" alt=""><figcaption></figcaption></figure>

Voici donc les 4 valeurs : *`0x3e4ccccd, 0x3e99999a, 0x3e99999a, 0x3f800000`*\
Maintenant il va falloir les convertir en float pour pouvoir les arrondir au dixième.

Pour cela, nous allons utiliser [ce site](https://gregstoll.com/~gregstoll/floattohex/) et convertir chaque valeur :&#x20;

|     Hex    | Float |
| :--------: | :---: |
| 0x3e4ccccd |  0.2  |
| 0x3e99999a |  0.3  |
| 0x3e99999a |  0.3  |
| 0x3f800000 |   1   |

Maintenant nous avons plus qu'à mettre au propre le flag en faisant attention à ne pas tomber dans le piège du 1 :clown:\
Même s'il s'agit d'un 1, il est demandé de mettre les valeurs avec leur décimale, ce qui donne : 1.0

<details>

<summary>🚩 FLAG</summary>

```
404CTF{vec4(0.2,0.3,0.3,1.0)}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://writeups.ayweth20.com/2023/404ctf-2023/retro-ingenierie/linspiration-en-images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
