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

How the Bank Vault Cracking Works

The script starts by declaring a list named digits with single character strings ’0’ and ’1’.

digits = ['0','1']

 

The display.show(Image.ARROW_W) call makes the LED display point at the A button as a prompt to press it to start the process.  After that, the while True: loop repeatedly checks if the A button was pressed, and does nothing else until you press it.  After the A button is pressed, the display.clear() call erases the arrow so that it can start displaying the 0/1 digits without any leftover LED pixels from the arrow.

display.show(Image.ARROW_W)

while True:
    if button_a.was_pressed():
        
        display.clear()

 

These three nested loops cycle through each possible combination in pin.  The script starts setting a to ’0’, then b to ’0’, and c to ’0’.  Then, pin = ’’.join([a, b, c]) creates the string ’000’ by combining the three characters.  The for c in digits loop isn’t done yet so it sets c to ’1’.  Then, pin = ’’.join([a, b, c]) repeats, and this time, the result is ’001’.

        for a in digits:
            for b in digits:
                for c in digits:
                    pin = ''.join([a, b, c])

 

Now that the for c in digits loop is finished, the for b in digits loop has to do its next iteration, setting b to ’1’.  Since for c in digits is below and indented, it has to repeat that loop again.  This time, a is still ’0’, but b is now ’1’.  So, when c is ’0’, the result of pin = ’’.join([a, b, c]) is ’010’.  On the for c in digits second repetition, it sets c to ’1’ and the result of pin = ’’.join([a, b, c]) is ’011’.  It continues this way through all the possible 0/1 combinations.

A lot more happens each time through the for c loop.  First, it displays the current pin combination in the terminal.

                    print("pin =", pin)

 

Then, it displays the PIN as 0/1 digits with the LED display.

                    for x in range(0, len(pin)):
                        bit = int(pin[x])
                        brightness = bit * 9
                        display.set_pixel(x,4,9)
                        for y in range(0, 4):
                            display.set_pixel(x, y, brightness)

 

It also checks for the radio response from the Vault Receiver micro:bit.  This loop sends repeatedly and checks for a response each time.  When it does get a response, it exits the while response is None:… loop.

                    response = None
                    while response is None:
                        radio.send(pin)
                        sleep(100)
                        response = radio.receive()

 

Still inside the for c in digits… loop.  Once a response has been received, it prints to the terminal.  Then, if the response is “Access granted.”, it means the PIN was correct.  At that point, the correct PIN scrolls through the PIN Pad Transmitter micro:bit’s display repeatedly.

                    print(response)
                    if response == "Access granted.":
                        while True:
                            display.scroll(pin)

 

The response string could also be “Access denied.”  In that case, the script just waits 4 seconds, then clears its display and lets for c in digits…loop to repeat with the next pin string in the sequence.

                    sleep(4000)
                    display.clear()

 


Printer-friendly version
Script Cracks Vault PIN with Brute Force
Prev
Try This: Randomized Vault Key
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

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

© 2025 Parallax Learn • Built with GeneratePress