Write Up CTFlearn — Character Encoding
CTFlearn is great platform for learning cyber security. It contains many challenges from the easiest till the hardest. Also, it has great community for you to interact with other. Cyber security is not a new field in computer science. But, in this platform, you can learn about Web, Forensics, Binary, Reversing, Cryptography, Programming, and Miscellaneous.
The picture above is my stats, you can follow me by click this link. From the picture we can literally say that my interest is in web. But for this write up, I want to share about the Cryptography titled ‘Binary Encoding’.
Because I love code, so let’s finish this task using programming language. In this case, I will using Python. Okay, let’s do it. This is the question.
The most important concept in finishing a CTF challenge is that we can figure into the most important things. Because, not all important and there always a clue in the challenge. For the challenge above, we can focus on the title and the strange number.
If you ever learning about cryptography, I believe you will understand that the strange number is actually a hexadecimal. So to finish this job actually, you just need combining the important parameter in the challenge and type it into Google search.
Well, rather than using that way, let’s using the more cool way. Okay, in Python, there is a module named codecs. This module is define a set of base classes of an object. By this help, we can convert the encoded character of hexadecimal into text. The syntax is simple like this.
Let’s talk about the code
- In first line, the code will import a module named codecs
- In third line, the strange number is saved into variable named hexadecimal
- In fourth line, we combine the hexadecimal into one string format and saved it into variable named hexs. Because I was lazy to remove the space one by one, I prefer using join and split function.
- In fifth line, we decode the hexs into string. As you can see, it will call the codecs function named decode that takes two variables.
- In last line, we print out the output
If you run the program, it will get the output like this
Congratulation you got the flag`ABCTF{45C11_15_U53FUL}`
Well, thanks for reading this article, by writing this article. I just found a word that I want to share like this
The more you stick with something, the more you will understand it in the first sight ~ @handhikayp
If you really interest about something, I think you should chase it. Again thanks for reading, and always.
Have a Nice Code ✌