mirror of
https://github.com/dbisu/pico-ducky.git
synced 2026-01-21 17:26:00 +00:00
Compare commits
7 Commits
nugget_rem
...
no_mouse
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6de3e98dc | ||
|
|
018fce3592 | ||
|
|
3fd60760c6 | ||
|
|
21ffbeb415 | ||
|
|
895fc7af58 | ||
|
|
11467900c5 | ||
|
|
fc0c2556e0 |
@@ -86,7 +86,6 @@ For a language `LANG`, copy the following files from the zip's `lib` folder to t
|
|||||||
**DO NOT** change the names or extensions of the files. Just pick the right ones.
|
**DO NOT** change the names or extensions of the files. Just pick the right ones.
|
||||||
Replace `LANG` with the letters for your language of choice.
|
Replace `LANG` with the letters for your language of choice.
|
||||||
|
|
||||||
- `keyboard_layout.py`
|
|
||||||
- `keyboard_layout_win_LANG.py`
|
- `keyboard_layout_win_LANG.py`
|
||||||
- `keycode_win_LANG.py`
|
- `keycode_win_LANG.py`
|
||||||
|
|
||||||
|
|||||||
4
boot.py
4
boot.py
@@ -1,6 +1,10 @@
|
|||||||
from board import *
|
from board import *
|
||||||
import digitalio
|
import digitalio
|
||||||
import storage
|
import storage
|
||||||
|
import usb_hid
|
||||||
|
|
||||||
|
usb_hid.disable()
|
||||||
|
usb_hid.enable((usb_hid.Device.KEYBOARD,))
|
||||||
|
|
||||||
noStorageStatus = False
|
noStorageStatus = False
|
||||||
noStoragePin = digitalio.DigitalInOut(GP15)
|
noStoragePin = digitalio.DigitalInOut(GP15)
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from adafruit_hid.keycode import Keycode
|
|||||||
#from keyboard_layout_win_LANG import KeyboardLayout
|
#from keyboard_layout_win_LANG import KeyboardLayout
|
||||||
#from keycode_win_LANG import Keycode
|
#from keycode_win_LANG import Keycode
|
||||||
|
|
||||||
|
import supervisor
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import digitalio
|
import digitalio
|
||||||
from board import *
|
from board import *
|
||||||
@@ -32,7 +34,7 @@ duckyCommands = {
|
|||||||
'INSERT': Keycode.INSERT, 'NUMLOCK': Keycode.KEYPAD_NUMLOCK, 'PAGEUP': Keycode.PAGE_UP,
|
'INSERT': Keycode.INSERT, 'NUMLOCK': Keycode.KEYPAD_NUMLOCK, 'PAGEUP': Keycode.PAGE_UP,
|
||||||
'PAGEDOWN': Keycode.PAGE_DOWN, 'PRINTSCREEN': Keycode.PRINT_SCREEN, 'ENTER': Keycode.ENTER,
|
'PAGEDOWN': Keycode.PAGE_DOWN, 'PRINTSCREEN': Keycode.PRINT_SCREEN, 'ENTER': Keycode.ENTER,
|
||||||
'SCROLLLOCK': Keycode.SCROLL_LOCK, 'SPACE': Keycode.SPACE, 'TAB': Keycode.TAB,
|
'SCROLLLOCK': Keycode.SCROLL_LOCK, 'SPACE': Keycode.SPACE, 'TAB': Keycode.TAB,
|
||||||
'BAKCKSPACE': Keycode.BACKSPACE, 'DELETE': Keycode.DELETE,
|
'BACKSPACE': Keycode.BACKSPACE,
|
||||||
'A': Keycode.A, 'B': Keycode.B, 'C': Keycode.C, 'D': Keycode.D, 'E': Keycode.E,
|
'A': Keycode.A, 'B': Keycode.B, 'C': Keycode.C, 'D': Keycode.D, 'E': Keycode.E,
|
||||||
'F': Keycode.F, 'G': Keycode.G, 'H': Keycode.H, 'I': Keycode.I, 'J': Keycode.J,
|
'F': Keycode.F, 'G': Keycode.G, 'H': Keycode.H, 'I': Keycode.I, 'J': Keycode.J,
|
||||||
'K': Keycode.K, 'L': Keycode.L, 'M': Keycode.M, 'N': Keycode.N, 'O': Keycode.O,
|
'K': Keycode.K, 'L': Keycode.L, 'M': Keycode.M, 'N': Keycode.N, 'O': Keycode.O,
|
||||||
@@ -101,25 +103,33 @@ def parseLine(line):
|
|||||||
kbd = Keyboard(usb_hid.devices)
|
kbd = Keyboard(usb_hid.devices)
|
||||||
layout = KeyboardLayout(kbd)
|
layout = KeyboardLayout(kbd)
|
||||||
|
|
||||||
|
# turn off automatically reloading when files are written to the pico
|
||||||
|
supervisor.disable_autoreload()
|
||||||
|
|
||||||
# sleep at the start to allow the device to be recognized by the host computer
|
# sleep at the start to allow the device to be recognized by the host computer
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
|
|
||||||
# check GP0 for setup mode
|
led.value = True
|
||||||
# see setup mode for instructions
|
|
||||||
progStatus = False
|
|
||||||
progStatusPin = digitalio.DigitalInOut(GP0)
|
def getProgrammingStatus():
|
||||||
progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
|
# check GP0 for setup mode
|
||||||
progStatus = not progStatusPin.value
|
# see setup mode for instructions
|
||||||
|
progStatusPin = digitalio.DigitalInOut(GP0)
|
||||||
|
progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
|
||||||
|
progStatus = not progStatusPin.value
|
||||||
|
return(progStatus)
|
||||||
|
|
||||||
|
|
||||||
defaultDelay = 0
|
defaultDelay = 0
|
||||||
|
|
||||||
def runScript(file):
|
def runScript(file):
|
||||||
global defaultDelay
|
global defaultDelay
|
||||||
|
|
||||||
duckyScriptPath = file
|
duckyScriptPath = file
|
||||||
f = open(duckyScriptPath,"r",encoding='utf-8')
|
f = open(duckyScriptPath,"r",encoding='utf-8')
|
||||||
previousLine = ""
|
previousLine = ""
|
||||||
duckyScript = f.readlines()
|
for line in f:
|
||||||
for line in duckyScript:
|
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
if(line[0:6] == "REPEAT"):
|
if(line[0:6] == "REPEAT"):
|
||||||
for i in range(int(line[7:])):
|
for i in range(int(line[7:])):
|
||||||
@@ -131,11 +141,62 @@ def runScript(file):
|
|||||||
previousLine = line
|
previousLine = line
|
||||||
time.sleep(float(defaultDelay)/1000)
|
time.sleep(float(defaultDelay)/1000)
|
||||||
|
|
||||||
|
def selectPayload():
|
||||||
|
payload = "payload.dd"
|
||||||
|
# check switch status
|
||||||
|
# payload1 = GPIO4 to GND
|
||||||
|
# payload2 = GPIO5 to GND
|
||||||
|
# payload3 = GPIO10 to GND
|
||||||
|
# payload4 = GPIO11 to GND
|
||||||
|
payload1Pin = digitalio.DigitalInOut(GP4)
|
||||||
|
payload1Pin.switch_to_input(pull=digitalio.Pull.UP)
|
||||||
|
payload1State = not payload1Pin.value
|
||||||
|
payload2Pin = digitalio.DigitalInOut(GP5)
|
||||||
|
payload2Pin.switch_to_input(pull=digitalio.Pull.UP)
|
||||||
|
payload2State = not payload2Pin.value
|
||||||
|
payload3Pin = digitalio.DigitalInOut(GP10)
|
||||||
|
payload3Pin.switch_to_input(pull=digitalio.Pull.UP)
|
||||||
|
payload3State = not payload3Pin.value
|
||||||
|
payload4Pin = digitalio.DigitalInOut(GP11)
|
||||||
|
payload4Pin.switch_to_input(pull=digitalio.Pull.UP)
|
||||||
|
payload4State = not payload4Pin.value
|
||||||
|
|
||||||
|
|
||||||
|
if(payload1State == True):
|
||||||
|
payload = "payload.dd"
|
||||||
|
|
||||||
|
elif(payload2State == True):
|
||||||
|
payload = "payload2.dd"
|
||||||
|
|
||||||
|
elif(payload3State == True):
|
||||||
|
payload = "payload3.dd"
|
||||||
|
|
||||||
|
elif(payload4State == True):
|
||||||
|
payload = "payload4.dd"
|
||||||
|
|
||||||
|
else:
|
||||||
|
# if all pins are high, then no switch is present
|
||||||
|
# default to payload1
|
||||||
|
payload = "payload.dd"
|
||||||
|
|
||||||
|
|
||||||
|
return payload
|
||||||
|
|
||||||
|
progStatus = False
|
||||||
|
progStatus = getProgrammingStatus()
|
||||||
|
|
||||||
if(progStatus == False):
|
if(progStatus == False):
|
||||||
# not in setup mode, inject the payload
|
# not in setup mode, inject the payload
|
||||||
print("Running payload.dd")
|
payload = selectPayload()
|
||||||
runScript("payload.dd")
|
print("Running ", payload)
|
||||||
|
runScript(payload)
|
||||||
|
|
||||||
print("Done")
|
print("Done")
|
||||||
else:
|
else:
|
||||||
print("Update your payload")
|
print("Update your payload")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
time.sleep(1.0)
|
||||||
|
led.value = False
|
||||||
|
time.sleep(1.0)
|
||||||
|
led.value = True
|
||||||
|
|||||||
Reference in New Issue
Block a user