Tags: misc 

Rating:

# Hello World

We're given a program source code file that appears to be mostly empty.

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-TAMU/images/Hello-World-1.png)

Let's hexdump it to see if it really is mostly empty.

```
$ xxd hello_world.cpp
```

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-TAMU/images/Hello-World-2.png)

As we can see, it actually isn't empty. It's filled with a bunch of `0x20` and `0x09`. `0x20` is a space, and `0x09` is a tab. So while it looks like there's nothing there, this program is actually chock full of whitespace. We can also see that these spaces and tabs alternate between each other almost randomly. I wonder if they're encoding some kind of data?

Because only spaces and tabs are featured, intuition tells me that they must be encoding binary.

This is a little script I made to go through the file and convert the spaces and tabs to binary.

```python
#!/usr/bin/env python3

with open("hello_world.cpp", "r") as f:
lines = f.readlines()

for line in lines:
binary = ""
for c in line[2::].strip("\n"):
binary += "0" if c == " " else "1"

print("{:0>8}".format(binary)) # Pad with leading 0s if len < 8
```

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-TAMU/images/Hello-World-3.png)

Alright. Now that we have our bytes, all that's left is to convert them to ASCII. I'm using [RapidTables](https://www.rapidtables.com/convert/number/binary-to-ascii.html) here.

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-TAMU/images/Hello-World-4.png)

Original writeup (https://github.com/shawnduong/ctf-writeups/blob/master/2019-TAMU/Misc/Hello-World.md).