TryHackMe Write-up: Intro to Python
This is my write up for TryHackMe’s Intro To Python. Unlike other rooms I have written about, this is actually an introductory tutorial on Python. With that being said, this room is composed of reading materials and quiz type questions. Given this, we will be tackling “Tasks” with questions.
[Task 3] Mathematical Operators
This task discusses the math operators and symbols commonly used in Python. Answers for this task can be solved simply by reading the accompanying reading material.
[Task 5] Variables and Data Types
This task discusses the variables and the common data types variables can be specified as. Just like Task 3, the answers for this task can be solved by understanding the reading material.
[Task 12] Challenge Time!
As the name implies, this task is where we get to apply everything taught in the earlier tasks.
Reading the above task, we determine the following facts:
- We need to use python’s base64 library to decode the contents of the file “encoded_flag.txt”.
- The original (non-encoded/readable) data was encoded 15 times before it was written to the file.
Given this, we need to do the following:
- Open the file.
- Read the file contents.
- Decode the contents.
- Print the decoded data.
In order to decode, we need to do decode by following how it encoding was done, but in reverse. So the decoding order should be:
- Base 16 decode 5 times
- Base 32 decode 5 times
- Base 64 decode 5 times
Given that the earlier tasks discussed Python3, we will use Python3 for the decoder script.
Running the script, we are able to get the decoded message: