The answersDownload the PDF
Worksheet

F11.9 Project: secure the robot

Cyber security · GCSE · OCR J277 1.4.2, AQA 8525 3.6.3, Edexcel 1CP2 4.2.1 · about 25 min

BugBotLab
NameClassDate

What this lesson is about

Authenticate with a password, decrypt an encrypted command, and act on it.

Questions 5 marks in all

  1. [1 mark]Why does the robot authenticate before taking a command?

    1. ASo only someone with the password can control it
    2. BTo make it faster
    3. CTo save battery
    4. DTo encrypt the mat
  2. [1 mark]Why is the command encrypted?

    1. ASo a listener on the radio cannot understand it
    2. BTo make it shorter
    3. CSo it arrives faster
    4. DSo the robot can ignore it
  3. [1 mark]A listener hears the Base's encrypted reply, KTWBFWI 25. What can they read without the key?

    1. AOnly the number 25, because the Caesar cipher shifts letters and leaves digits alone
    2. BThe whole command
    3. CNothing at all
    4. DThe key
  4. [1 mark]Authentication and encryption together protect against what?

    1. AImpostors giving commands and listeners reading them
    2. BOnly power cuts
    3. COnly malware
    4. DOnly slow networks
  5. [1 mark]If the wrong password is sent, what should the robot do?

    1. ANot move
    2. BDrive anyway
    3. CSend its password
    4. DTurn off the radio

The task: secure the robot

Authenticate with the Base using the password bugbot42, decrypt its reply with a Caesar cipher (key 5), and carry out the FORWARD <cm> command to reach the green depot, without collisions. Do not send any command before the password, and do not type the distance: read it from the decrypted message. The caesar helper is provided.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

def caesar(text, key):
    out = ""
    for ch in text:
        if ch.isalpha():
            base = ord("A")
            out = out + chr((ord(ch.upper()) - base + key) % 26 + base)
        else:
            out = out + ch
    return out

def ask(question, seconds=1.5):
    send(question)
    for tick in range(int(seconds * 10)):
        wait(0.1)
        for sender, text in messages():
            return text
    return None

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/f11-9-project-secure-the-robot/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Try sending the wrong password first. Does your program correctly refuse to move?
  2. Someone else on the mat is listening. The Base's reply is KTWBFWI 25: what can they read without the key? (Look at what the Caesar cipher leaves alone.) And what did they learn when your robot sent the password?
  3. Encrypt your own reply to the Base to confirm you have arrived, and send it.