TryHackMe – Advent of Cyber 2023 – Day 14

TryHackMe Advent of Cyber 2023 Day 14

Day 14 of the Advent of Cyber 2023 is about machine learning, and neural networks in particular. In it, we walk through (and complete) a Python script that demonstrates how a neural network works. We then use the neural network script to generate predictions, and test the accuracy of the predictions.

As someone who doesn’t have much experience with ML or neural networks, I found this challenge to be very interesting, although I didn’t feel like I learned anything applicable to my cybersecurity skill set (other than some general knowledge about ML).

Advent of Cyber 2023 can be found at: https://tryhackme.com/room/adventofcyber2023

About This Walkthrough/Disclaimer:

In this walkthrough I try to provide a unique perspective into the topics covered by the room. Sometimes I will also review a topic that isn’t covered in the TryHackMe room because I feel it may be a useful supplement.

I try to prevent spoilers by requiring a manual action (highlighting) to obtain all solutions. This way you can follow along without being handed the solution if you don’t want it. Always try to work as hard as you can through every problem and only use the solutions as a last resort.

Walkthrough for Advent of Cyber 2023 Day 14

The first 5 questions are just machine-learning vocabulary based on the description.

The actual ‘challenge’ starts at Question # 6.

Question 1

What is the other term given for Artificial Intelligence or the subset of AI meant to teach computers how humans think or nature works?

Answer (Highlight Below):

Machine Learning

Question 2

What ML structure aims to mimic the process of natural selection and evolution?

Answer (Highlight Below):

Genetic algorithm

Question 3

What is the name of the learning style that makes use of labelled data to train an ML structure?

Answer (Highlight Below):

Supervised learning

Question 4

What is the name of the layer between the Input and Output layers of a Neural Network?

Answer (Highlight Below):

Hidden layer

Question 5

What is the name of the process used to provide feedback to the Neural Network on how close its prediction was?

Answer (Highlight Below):

back-propagation

Question 6

What is the value of the flag you received after achieving more than 90% accuracy on your submitted predictions?

To do this challenge, we first need to complete the detector.py script.

Following the instructions in the description, I created the data sets by adding the following code into the script:

Dataset split code TryHackMe Advent of Cyber 2023 Day 14

Then I added the normalization code:

Normalization code Advent of Cyber 2023 Day 14

Next I added the classifier code:

Classifier code Advent of Cyber 2023 Day 14

And added the code to train the classifier:

Next I added the classifier validation prediction code:

Adding the classifier validation prediction code.

The last step is adding the classifier testing prediction code:

Adding the classifier testing prediction code TryHackMe Advent of Cyber 2023 Day 14

After finishing the Python script, I ran it in a terminal:

python3 detector.py
Running the neural network script

The script saves its output into predictions.txt:

The predictions from the neural network script TryHackMe Advent of Cyber 2023 Day 14

In the VM, I navigated to http://websiteforpredictions.thm:8000/ and uploaded my prediction. I got the flag on the first try!

Checking the accuracy of neural network predictions TryHackMe Advent of Cyber 2023 Day 14

Answer (Highlight Below):

THM{Neural.Networks.Are.Neat!}