TryHackMe Write-up: Intro to Python

Introduction

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:

  1. We need to use python’s base64 library to decode the contents of the file “encoded_flag.txt”.
  2. 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:

  1. Open the file.
  2. Read the file contents.
  3. Decode the contents.
  4. 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:

  1. Base 16 decode 5 times
  2. Base 32 decode 5 times
  3. 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:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store