Skip to content

Instantly share code, notes, and snippets.

@datadiode
Created October 5, 2021 11:35
Show Gist options
  • Save datadiode/5dbad7c8bd378cc407fd3a7dbbb3e735 to your computer and use it in GitHub Desktop.
Save datadiode/5dbad7c8bd378cc407fd3a7dbbb3e735 to your computer and use it in GitHub Desktop.
Bitlocker PIN dongle based on Raspberry Pi Pico running CircuitPython firmware
import board
import digitalio
import time
import storage
storage.disable_usb_drive()
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True
time.sleep(0.2)
led.value = False
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
try:
kbd = Keyboard(usb_hid.devices)
kbd_layout = KeyboardLayoutUS(kbd)
for x in range(3):
time.sleep(3)
led.value = True
time.sleep(0.1)
led.value = False
if kbd.led_on(Keyboard.LED_NUM_LOCK):
kbd_layout.write("\b\b\b\b\b\b\b\b12345678\n")
except:
for x in range(3):
time.sleep(0.4)
led.value = True
time.sleep(0.1)
led.value = False
time.sleep(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment