# Surfing the Waves

## Problem

> While you're going through the FBI's servers, you stumble across their incredible taste in music. One [main.wav](https://github.com/HHousen/PicoCTF-2021/blob/master/Forensics/Surfing%20the%20Waves/main.wav) you found is particularly interesting, see if you can find the flag!

## Solution

1. Opening the audio file in audacity and applying the amplify effect shows that there is some kind of pattern in the file.
2. We can extract the data using Python and Scipy in [script.py](https://github.com/HHousen/PicoCTF-2021/blob/master/Forensics/Surfing%20the%20Waves/script.py). If we read each audio frame we see that the first 6 values are: `[2008, 2506, 2000, 1508, 2009, 8504]`. I looped through all the values but chopped off the last two digits. The last two digits are always `0` followed by a number 1 though 9, which seem like random noise. After we remove the last two digits, there are only 16 unique values: `[10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85]`. There are also only 16 values in hexadecimal, so the data is probably encoded using hexadecimal.
3. We assume that `10` represents `1` in hexadecimal, `15` represents `2`, `55` represents `a`, etc. So, now all we have to do is apply this mapping by looping through the rounded audio file data and mapping the value to its position in the sorted list of unique values. Each rounded audio file data point represents a hexadecimal character that has been encoded in some way. By looping through them we can undo the encoding using the aforementioned mapping. Then we can combine all the hexadecimal characters into one large hexadecimal string and convert it to ascii to get the entire program that was used to create the audio file. I saved the challenge program to [decoded\_program.py](https://github.com/HHousen/PicoCTF-2021/blob/master/Forensics/Surfing%20the%20Waves/decoded_program.py).

### Flag

`picoCTF{mU21C_1s_1337_115155af}`


---

# 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://picoctf2021.haydenhousen.com/forensics/surfing-the-waves.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.
