Up to this point, you just finished adding encryption to the countdown app from the Cybersecurity: Radio Data tutorial’s Send and Receive Packets activity. Now, let’s apply the same technique to the wireless cyber:bot keyboard control app from the Cybersecurity: Navigation Control from a Keyboard tutorial’s Terminal Control — Go Wireless! activity. If you can do this, you will have a level of protection against attackers in future cyber:bot competitions.
- Go to Terminal Control — Go Wireless! and get the application running again. Make sure to use the transmitter script from Your Turn: Handle Transmitter Exceptions and the receiver script at the end of the Receiver Script for cyber:bot Output page.
- Set the project name of the transmitter script you will modify to terminal_bot_controller_wireless_encrypted.
- Set the project name of the receiver script as terminal_controlled_bot_wireless_encrypted.
- Repeat the steps from the previous page you just followed to add encryption to the radio data countdown app:
- Step 1: Copy the ascii_shift() function from the ASCII Shift Cipher activity’s ascii_shift_cipher script and paste it into the transmitter and receiver scripts, just below the import statements.
- Step 2: Add key = 5 to the transmitter script and key = -5 to the receiver script.
- Step 3:
- In the transmitter script, add packet = ascii_shift(key, packet) immediately above radio.send(packet).
- In the receiver script, add packet = ascii_shift(key, packet) immediately below and indented from if packet is not None: MAKE SURE TO INDENT PROPERLY. The packet = ascii_shift(key, packet) statement has to be indented further than if packet is not none:
- Add print statements to demonstrate that your data is transmitted and received in an encrypted form. For hints on how to do this, examine the Try This: Monitor Encrypted Text in the previous activity.
- Save your scripts.
- Verify that the app works with encryption as shown below.