← View all posts

Solve HQ L09 C08 with CyberStart Community member Michael

Solve HQ L09 C08 with CyberStart Community member Michael

This is a guest post written by Michael who is part of the CyberStart Community.

Find out the tips and processes players use to solve CyberStart’s challenges.

Michael walks through a challenge in HQ base and shows how he solved it.

Note: This blog contains spoilers and solutions to HQ L09 C08 - Bogdan’s Data

Michael - HQ L09 C08 - Bogdan’s Data

“It was very nice to learn a new Python command in the challenge, as now I can carry on knowing just a little more about Py”.

Part 1: Briefing

“Alright,” I tell myself, “new challenge”.

Challenge briefing

“The briefing mentions ‘services.cyberprotection.agency:3166’, which looks similar to information required to use sockets. 99% we’re using that”.

“Just gonna read in a little… source code? Oh, cool, a .py file. It’s not password protected, I’m probably just fixing some code.”

CyberStart challenge

So, I downloaded the code and uploaded it to my work environment.

“Yeah, it’s sockets. Let’s run it…”

[NameError: name 'clientsock is not defined]

And I get my first error.

“Ok, uh… oh. “sockets” hasn’t been imported yet. Do that…”

[NameError: name 'clientsock' is not defined]

And another.

“Oh right, we didn’t actually initialize ‘clientsock’. Lemme just open Moon L03 C02 for a quick paste…”

And I pasted in the socket initializing code. And then I ran it once more.

[TypeError: a bytes-like object is required, not 'str']

“Alright, I just have to specify the string in here as bytes. Easy peasy!”

“Just gonna code up something on main.py to access this file…”

I run it again. No errors, but instead, nothing is output.

“Ok, so no console output… hrmm. What’s with it?”

And then it hit me. I was fixing code… that was just grabbed source code being ran on the server. One facepalm later, I knew exactly what I had to do.

“Alright! Let’s modify this to connect instead and see what happens, commenting out the source code.”

Looking at the source code, I saw some pretty weird stuff. First of all, this “eval” command was something I’d never seen before. So, I started messing around to see if I could make something work.

“Not sure what this math is, but I’ll just set both numbers to the same thing and see what happens.”

Spoilers: It didn’t work.

“Yep, didn’t work. I expected that… time to do some research on eval().”

After some research on the eval() python command, I noticed it actually allows you to set variables to other values/variables. So, I got a bright idea.

“Ok, let’s make the second number our first number by sending secondNum = firstNum!”

It worked, and I got the flag!

See how a CyberStart Community member solved HQ L06 C06 in this blog post.

One of the biggest challenges I faced was understanding the new command, eval(). I was completely unfamiliar with this. I hadn’t used it or seen it before in any Python programs. I wasn’t sure what it was doing. I only assumed I could input numbers for quite a while.

After some research, though, it was much clearer what the solution would be! It was very nice to learn a new Python command in the challenge, as now I can carry on knowing just a little more about Py.

In addition to HQ, you’ll learn how to use Python in Moon base. Find out more in our Moon base blog post.

It may be obvious from the storyline, but I have a fairly logical process for going about solving these challenges.

First, I scan the briefing for my goal and any hints/clues at what I should try.

Second, I mess around with what’s given to see where I can go and what to try.

Then, if I find something new (and I usually do!), I enter a research phase to figure out these new concepts. The research usually takes the longest, since I don’t always know what I’m looking for!

Ready to get stuck into fun, problem-solving challenges like these? Have a go for free right now in CyberStart’s Intern base or upgrade to access HQ, Moon and Forensics base.

All of these programmes are entirely free, and feature CyberStart!

CyberStart America

What is it?

A fun programme developed to help you discover your talent, advance your skills and win scholarships in cyber security.

Who's it for?

13-18 year old high school students in the US only.

Awesome! How can I find out more?

Cyber FastTrack

What is it?

The fastest and most cost-effective route to a career in cyber security via free training and exclusive scholarship opportunities.

Who's it for?

College students in the US only.

Great! How can I find out more?

CyberStart Canada

What is it?

A free programme teaching cyber security to high school students in Canada through CyberStart's immersive learning platform.

Who's it for?

Students between the ages of 13-18 nationwide.

Nice! How can I find out more?