# Magical Television Write-up for Tuning Machine
>From: Firebird CTF 2024
>Tags: Forensics
>Problem author: ppcc
>Problem statement:
><div class="common_markdownContent__gMBWU"><p>In a medieval world filled with <em>magic</em>, the concept of television was still unknown. Instead, <em>magic</em> was used to communicate and share information. One such <em>magical artifact</em> was the <em>"Book of Transcendence"</em>, a mysterious tome containing all the <em>knowledge</em> and <em>wisdom</em> of the ancient world.</p>
><p>Legend had it that the book was <em>indestructible</em> and contained spells and incantations that could be used to communicate across great distances and even through <em>time</em> itself.</p>
><p>However, despite its <em>magical properties</em>, the book could not be easily deciphered by anyone. It required a special kind of person with a pure heart, unbreakable will, and an unyielding spirit to unlock its secrets. The book would reveal its secrets through mystical symbols and images that only <strong>the chosen one</strong> could decipher.</p>
><h2>Thus, the Book of Transcendence remains a symbol of perseverance and determination, inspiring those who sought knowledge and power in a world filled with magic and mystery. The book was so powerful that it could even change the course of history, but only if it was used wisely and with great care. The book was a reminder that true power comes not from technology or wealth, but from within oneself.</h2>
><p>tl;dr the flag is here.</p>
><p><a href="https://ash-files.firebird.sh/12/magic_television.mp4">Book of Transcendence</a></p></div>
>
>Solved by: Jackylkk2003
## Foreword
Before we start, let's hope firebird will not take down the magical TV so that the link above would keep working.
Well, nothing much to add here. Let's go straight into the observations.
## Observations
1. There are many formattings in the problem statement.
- We will discuss more on this at the later stages.
2. When we are watching the video, there are no audio and subtitles, and the video looks like random noise.
- Here is an example frame
- 
3. With careful inspection, the "random noise" shows some repeating patterns.
- It is especially obvious around the edge of the video.
## Insights
1. The problem statement may be useful, but its use is not yet known.
2. Since the video looks like random noise, this challenge should be focusing on steganography(stego).
- So the first thing we do is the common stego tricks:
- file, binwalk, strings, foremost, exiftool
- Sadly, no luck in doing so.
- The second thing: capture a frame and check LSB.
- Still no luck.
3. ~~By some unknown reasons/ Tuning,~~ I somehow break the video into individual frames, in png format.
- ~~Well, a video with only visuals are basically just multiple stacked images~~
- I first transformed them into a gif image, and then to the pngs
- These can be done using online tools, go Google.
- ~~I got more than 1000 images by doing so.~~
5. At the current stage, we have no idea how useful is the repeating property.
- We are even not sure if it is really repeating itself or not, at least it looks like so.
## Next Step
Since Google is our good friend, we go and search for some CTF stego related websites. ~~(Since LSB and binwalk are all I know about stego, and too bad couldn't solve Aura)~~ At least, I found [this website]( https://fareedfauzi.gitbook.io/ctf-playbook/steganography) ~~when I am solving Aura~~.
Since we have decomposed the video into images, let's focus on the images part of the site.
Basically nothing until "Some of online stegano decoder".
~~Actually Stegsolve.jar can also do the job, but since I am not focusing on this challenge when I think of its solution, I did not use Stegsolve.jar to attempt this challenge.~~
With some trial and error until we find the last tool [Magic Eye Solver / Viewer](https://magiceye.ecksdee.co.uk), and this online tool has some example images.
Example original image:

Example hidden image:

We can observe that the original image as some repeating patterns. That is, it is similar to our video!
## Solution
Let's try to put our video image into the tool.

That is obviously part of our flag! We can put all our 1000 images into the tool.
Obviously we don't need to do that. Do sampling with a regular interval (around 2 seconds delay in the video, in my case, 200 images) would be good enough.
## Flag
Finally, we got the flag: `firebird{we_need_a_pair_of_magic_eyes!}`
## Fun Facts
1. I was solving another problem (yes, Aura, but still not solved :c) when I look at the site above. When I am solving Aura and suddenly see the repeating patterns in the example images of this tool, I quickly solved this challenge. It is actually quite surprising.
2. Observation 1 is useless. Even after I solved the challenge, I have no idea what the statement is about.
3. Looks like the flag knows what tools I am using.
4. The video is actually marginally readable if you have really strong eyes. (But completely impractical to do so during CTF, it may take more than an hour.)