# The 3D Printer Task
```We have 3D printed a great object, and wanted to show you... unfortunately we only have the video file of the print... and it's corrupted.But they say when you have 3d printed enough, you don't even hear the sounds. All you hear is blonde, brunette, redhead.```
The video shows a 3D printer printing some letters (SAF), but than the video freezes, and we can only hear the sounds of the rest of the printing, so our approach was to find out the others letters only by the sound of the printing.
The first thing we had to do was find out which font was used.
![Print of the printed letters.](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/LettersPrinted(1).jpg)
![Print of the printed letters.](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/LettersPrinted(2).jpg)
![Traced letters](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/tracedLetters.jpg)
After some(a lot of) research on the internet, we found a similar font, and we assumed the printer was only using the outline of the letters.https://www.1001fonts.com/freaks-of-nature-font.html
![Font](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/font.png)
We counted how many lines were needed to draw each letter/number (only the outline), and got the table below.```Letter - Number of linesI - 4L - 61 - 8D - 8T - 8F - 10P - 10Q - 100 - 12A - 12 B - 12E - 12H - 12 J - 12O - 12U - 124 - 147 - 14R - 145 - 166 - 169 - 16K - 16N - 16Y - 162 - 18G - 183 - 20C - 20M - 20S - 20V - 20W - 20Z - 20X - 36```So we openened the audio on Audacity, and using the spectogram view, we can clearly see the lines.![Spectogram of the audio](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/AudacityFullAudioEdited.jpg)
On (1) we have a pattern that repeats a lot in the audio, and when comparing it to the video, we can see that it is the sound of the printer moving to print another letter, so the space between them (2) shows the audio of it printing a letter, and the sound changes a little bit when the machine changes it's direction, so que can count how many lines the letter has (and the size of them). Than on (3) we have the pattern again, so we know it finished printing the letter. 
PS: The printer starts drawing on the bottom left of the letter.
## ExampleHere is the spectogram of the first A and the outline that it printed, i colored the lines for better visualization.
PS: The image on the right is zoomed in.
![ColoredExample](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/exampleColored.jpg)
## Letters### SAFOn the video we can see that the first three letters are SAF.
S-![S](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/S.jpg)
A-![A](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/A(1).jpg)
F-![F](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/F.jpg)
We can use their spectogram to help identifying others letters.
### {![{](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/oBracket.jpg)
This one has 16 lines, but the size of them don't match any letter from that font, so i assumed it was the '{', because the flag may be in the format SAF{...}
### A![A](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/A(2).jpg)
This one has 12 lines, and is very similar to the 'A' we got.
### I![I](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/I.jpg)
This one has only 4 lines, and by the size of them, its a rectangle, so has to be an 'I'.
### R![R](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/R.jpg)
This one has 14 lines, and we can see that the last one is a big one, so it matches the outline of the 'R'.
### G![G](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/G.jpg)
This one has 16 lines, but it didn't fit well in any of the letters with 16 lines of the font, but we thought you may be able to draw a 'G' with 16 lines (intead of 18), and the size of them matches the outline of a 'G'. 
### A![A](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/A(3).jpg)
This one has 12 lines and is similar to the others 'A's.
### PP![PP](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/PP.jpg)
Here we have two letters that are very similar, and have 10 lines, and the size of them matches the 'P'.
### E![E](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/E.jpg)
This one has 12 lines, and their sizes matches the outline of the 'E'.
### D![D](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/D.jpg)
This one has 8 lines, and their sizes mathches the outline of the 'D'.
### 2![2](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/2.jpg)
This one has 18 lines, and their sizes did not match any of the letters, so we compared it to the outline of the numbers, and it matches the '2'. 
### }![}](https://raw.githubusercontent.com/andrecoco/CTF_WriteUps/master/SpamAndHex020/3DPrinterTask/Images/Letters/cBracket.jpg)
We assumed tha flag had the format SAF{...}, and this one has the same amount of lines than the one we assumed to be an '{'.
```SAF{AIRGAPPED2}```