Toggle Navigation
Hatchery
Eggs
RubberDucky
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import display, keypad, appconfig, consts import rubberducky.interpreter as ducky settings = appconfig.get('rubberducky', { 'colour': 'F8B700', 'scripts': { '0': '/apps/rubberducky/rickroll.txt', '1': '/apps/rubberducky/lockme.txt', '2': '/apps/rubberducky/lock.txt', '3': '/apps/rubberducky/sleep.txt' } }) scripts = settings['scripts'] colour = int(settings['colour'], 16) def draw(): display.drawFill(0x00) for key in scripts.keys(): x, y = keypad.index_to_coords(int(key)) display.drawPixel(x, y, colour) display.flush() def on_key(index, pressed): x, y = keypad.index_to_coords(index) index = str(index) if index in scripts: if pressed: display.drawPixel(x, y, 0x00FF00) display.flush() print('Running', scripts[index]) ducky.run_script(scripts[index]) else: display.drawPixel(x, y, colour) display.flush() if int(consts.INFO_FIRMWARE_BUILD) < 20081009: print('Warning: RubberDucky needs at least firmware version 20081009!') keypad.add_handler(on_key) draw()