# Space Radio

**Catégorie:** Sécurité matérielle - **Difficulté:** Intro

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

**Description:**

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

Solution:

Tout comme l'autre challenge d'intro ([Trop d'IQ](/2025/404ctf-2025/securite-materielle/trop-diq.md)), il fallait réussir à convertir ce fichier .iq (signal audio) en un audio compréhensible par l'oreille humaine.

En sachant cela, j'ai créé un script qui fait tout ça automatiquement :&#x20;

```python
import numpy as np
from scipy.io.wavfile import write
from scipy.signal import decimate

# Paramètres
input_file = "fm.iq"
output_file = "output.wav"
input_sample_rate = 48000  # Hz
output_sample_rate = 16000  # Hz (pour lisibilité)

# Lire fichier IQ (on suppose Complex64 ici ; adapter si nécessaire)
iq_data = np.fromfile(input_file, dtype=np.complex64)

print(f"[+] Chargé {len(iq_data)} échantillons IQ")

# Étape 1 : Récupérer la phase
phase = np.angle(iq_data)

# Étape 2 : Différence de phase = fréquence instantanée
# On ajoute un 0 devant pour garder la taille
freq = np.diff(phase, prepend=phase[0])

# Étape 3 : Optionnel - corriger le saut de phase (unwrap)
freq = np.unwrap(freq)

# Étape 4 : Décimation pour baisser la fréquence d'échantillonnage
decim = int(input_sample_rate / output_sample_rate)
audio = decimate(freq, decim)

# Étape 5 : Normaliser entre -1 et 1
audio /= np.max(np.abs(audio))
audio = audio.astype(np.float32)

# Écriture du WAV
write(output_file, output_sample_rate, audio)

print(f"[+] Audio FM sauvegardé dans '{output_file}' ({output_sample_rate} Hz)")
```

Et en sortie, nous avons un bel audio bien propre que nous pouvons écouter (peut-être un peu rapide) :&#x20;

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

<details>

<summary>🚩FLAG</summary>

`404CTF{32788739f83}`

</details>


---

# Agent Instructions: 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:

```
GET https://writeups.ayweth20.com/2025/404ctf-2025/securite-materielle/space-radio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
