Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Cybersecurity: Brute Force Attacks & Defenses

Cybersecurity: Brute Force Attacks & Defenses

Try This: Randomized Vault Key

If you are doing these activities by yourself, or want to make it to where you won’t have any knowledge of the PIN you are trying to crack, then modify the bank_vault_receiver script to create a random pin.  

Example script: bank_vault_receiver_random_pin

  • Change the bank_vault_receiver project name to bank_vault_receiver_random_pin.
  • Make the changes indicated by the comments below.
  • Save the modified script and flash it into the Bank Vault Receiver micro:bit by clicking Send to micro:bit.
# bank_vault_receiver_random_pin              # <- change

from microbit import *
import radio
import random                                 # <- add                                 

radio.on()
radio.config(channel=7)

sleep(1000)

# pin = '011'                                 # <- comment
pin = ''                                      # <- add
for n in range(3):                            # <- add
    number = str(random.randint(0,1))         # <- add
    pin += number                             # <- add
print("Random pin =", pin)                    # <- add

while True:

    display.set_pixel(2,2,9)
    
    message = radio.receive()
    
    if message:
        if message == pin:
            radio.send("Access granted.")
            for n in range(4):
                display.show(Image.YES)
                sleep(1000)
                display.clear()
                sleep(200)
        else:
            radio.send("Access denied.")
            display.show(Image.NO)
            sleep(3000)

        display.clear()    
  • If the serial monitor is not already open, click Show serial in the micro:bit Python Editor. 
  • Examine the messages from the Bank Vault Receiver micro:bit in the terminal.
  • Try pressing and releasing the reset button a few times (at least 1 second apart). 

Each time you reset the Bank Vault micro:bit, it should display a new random PIN in the terminal.  (Don’t worry if your random sequence is different from what’s shown here.  Yours only has a 1 in 8 chance of matching for any given reset.)

  • Make sure the PIN Pad Transmitter micro:bit is still running bank_vault_crack.
  • Press/release the PIN Pad Transmitter micro:bit’s reset button, then its A button to restart the script and find that randomly determined PIN.

How it Works: vault_receiver_random_pin

In the place of a previously decided PIN, there is now an empty string and a for loop that repeats three times—randomly choosing a 0 or 1- and then appending the pin string with that digit.  

# pin = '011'                                 # <- comment
pin = ''                                      # <- add
for n in range(3):                            # <- add
    number = str(random.randint(0,1))         # <- add
    pin += number                             # <- add
print("Random pin =", pin)                    # <- add

 


Printer-friendly version
How the Bank Vault Cracking Works
Prev
Decimal Vault PIN
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress