CyberQuest - POGIL Activity

Reading Code and the Terminal

A guided-inquiry activity. Work in a team of 3 to 4, or on your own. Read each Model, then answer the Critical Thinking Questions in order before revealing a hint.

Learning objectives

Prerequisites: none. This is a Day 1 starting activity.

Team roles

Manager - keeps time, makes sure everyone participates, keeps the team on task.
Recorder - writes the team's agreed answers and questions to ask.
Presenter - speaks for the team and shares answers.
Reflector - watches teamwork and suggests one improvement.

Model 1: Code and its output

agent = "Ada"
tries = 3
print(agent, "has", tries, "tries left")

Output: Ada has 3 tries left

  1. Which two names in Model 1 store values, and what does each hold?
    Check your thinking

    agent holds the text Ada (a string); tries holds the number 3 (an integer).

  2. Why does the output show Ada and 3 instead of the words agent and tries?
    Check your thinking

    print shows the values stored in the variables, not the variable names.

  3. Predict the output if tries were changed to 1.
    Check your thinking

    Ada has 1 tries left (the program does not fix grammar; it just prints the value).

Model 2: A loop, traced

for n in range(1, 4):
    print("step", n)
passnprints
11step 1
22step 2
33step 3
  1. How many times does the loop body run, and why does it stop?
    Check your thinking

    Three times. range(1, 4) gives 1, 2, 3 and stops before 4.

  2. What changes on each pass through the loop?
    Check your thinking

    The value of n increases by 1 each pass.

  3. In one sentence, what does a loop let you avoid?
    Check your thinking

    Writing the same line many times by hand; the computer repeats it for you.

Model 3: Reading a terminal session

bob@lab:~$ whoami
bob
bob@lab:~$ cat readme.txt
The next password is: rABbit2
  1. Who is logged in, and which command showed that?
    Check your thinking

    The user bob; the whoami command showed it.

  2. Which command displayed the file contents, and what fact did it reveal?
    Check your thinking

    cat readme.txt displayed the file; it revealed the next password, rABbit2.

  3. Reading carefully and extracting the key fact is a security skill. List the three facts a defender could record from this session.
    Check your thinking

    The user (bob), the actions taken (whoami, cat readme.txt), and the sensitive item exposed (a password in a readable file).

Do it now

Open Day1.ipynb and run the variable and loop cells. Then play OverTheWire Bandit Level 0 and read the password from a file, just like Model 3.

Application

You are handed an unfamiliar log line: 09:06 admin login FAILED from 10.0.0.9. List three facts you can extract from it.

Reflection (process skills)

What helped your team agree on the output predictions? What is one thing you will do differently on the next Model?