mirror of
https://github.com/dbisu/pico-ducky.git
synced 2026-01-21 17:26:00 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2876f80140 | ||
|
|
0988524506 | ||
|
|
e11b087b75 | ||
|
|
f79fe2cb48 | ||
|
|
3d101c82d4 |
18
README.md
18
README.md
@@ -50,7 +50,7 @@ Enter setup mode.
|
|||||||
Copy boot.py to the root of the pico-ducky.
|
Copy boot.py to the root of the pico-ducky.
|
||||||
Copy your payload script to the pico-ducky.
|
Copy your payload script to the pico-ducky.
|
||||||
Disconnect the pico from your host PC.
|
Disconnect the pico from your host PC.
|
||||||
Connect a jumper wire between pin 18 and pin 20.
|
Connect a jumper wire between pin 18 (`GND`) and pin 20 (`GPIO15`).
|
||||||
This will prevent the pico-ducky from showing up as a USB drive when plugged into the target computer.
|
This will prevent the pico-ducky from showing up as a USB drive when plugged into the target computer.
|
||||||
Remove the jumper and reconnect to your PC to reprogram.
|
Remove the jumper and reconnect to your PC to reprogram.
|
||||||
The default mode is USB mass storage enabled.
|
The default mode is USB mass storage enabled.
|
||||||
@@ -111,6 +111,22 @@ from keyboard_layout_win_LANG import KeyboardLayout
|
|||||||
from keycode_win_LANG import Keycode
|
from keycode_win_LANG import Keycode
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Example: Set to German Keyboard (WIN_DE)
|
||||||
|
|
||||||
|
```py
|
||||||
|
from keyboard_layout_win_de import KeyboardLayout
|
||||||
|
from keycode_win_de import Keycode
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy the files keyboard_layout_win_de.mpy and keycode_win_de.mpy to the /lib folder on the Pico board
|
||||||
|
```
|
||||||
|
adafruit_hid/
|
||||||
|
keyboard_layout_win_de.mpy
|
||||||
|
keycode_win_de.mpy
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Useful links and resources
|
## Useful links and resources
|
||||||
|
|
||||||
### Docs
|
### Docs
|
||||||
|
|||||||
@@ -14,11 +14,30 @@ 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 *
|
||||||
led = digitalio.DigitalInOut(LED)
|
import pwmio
|
||||||
led.direction = digitalio.Direction.OUTPUT
|
|
||||||
|
led = pwmio.PWMOut(LED, frequency=5000, duty_cycle=0)
|
||||||
|
|
||||||
|
def led_pwm_up(led):
|
||||||
|
for i in range(100):
|
||||||
|
# PWM LED up and down
|
||||||
|
if i < 50:
|
||||||
|
led.duty_cycle = int(i * 2 * 65535 / 100) # Up
|
||||||
|
time.sleep(0.01)
|
||||||
|
def led_pwm_down(led):
|
||||||
|
for i in range(100):
|
||||||
|
# PWM LED up and down
|
||||||
|
if i >= 50:
|
||||||
|
led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100) # Down
|
||||||
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
# led = digitalio.DigitalInOut(LED)
|
||||||
|
# led.direction = digitalio.Direction.OUTPUT
|
||||||
|
|
||||||
duckyCommands = {
|
duckyCommands = {
|
||||||
'WINDOWS': Keycode.WINDOWS, 'GUI': Keycode.GUI,
|
'WINDOWS': Keycode.WINDOWS, 'GUI': Keycode.GUI,
|
||||||
@@ -101,9 +120,13 @@ 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)
|
||||||
|
|
||||||
|
led_pwm_up(led)
|
||||||
|
|
||||||
def getProgrammingStatus():
|
def getProgrammingStatus():
|
||||||
# check GP0 for setup mode
|
# check GP0 for setup mode
|
||||||
@@ -120,19 +143,22 @@ def runScript(file):
|
|||||||
global defaultDelay
|
global defaultDelay
|
||||||
|
|
||||||
duckyScriptPath = file
|
duckyScriptPath = file
|
||||||
f = open(duckyScriptPath,"r",encoding='utf-8')
|
try:
|
||||||
previousLine = ""
|
f = open(duckyScriptPath,"r",encoding='utf-8')
|
||||||
for line in f:
|
previousLine = ""
|
||||||
line = line.rstrip()
|
for line in f:
|
||||||
if(line[0:6] == "REPEAT"):
|
line = line.rstrip()
|
||||||
for i in range(int(line[7:])):
|
if(line[0:6] == "REPEAT"):
|
||||||
#repeat the last command
|
for i in range(int(line[7:])):
|
||||||
parseLine(previousLine)
|
#repeat the last command
|
||||||
time.sleep(float(defaultDelay)/1000)
|
parseLine(previousLine)
|
||||||
else:
|
time.sleep(float(defaultDelay)/1000)
|
||||||
parseLine(line)
|
else:
|
||||||
previousLine = line
|
parseLine(line)
|
||||||
time.sleep(float(defaultDelay)/1000)
|
previousLine = line
|
||||||
|
time.sleep(float(defaultDelay)/1000)
|
||||||
|
except OSError as e:
|
||||||
|
print("Unable to open file ", file)
|
||||||
|
|
||||||
def selectPayload():
|
def selectPayload():
|
||||||
payload = "payload.dd"
|
payload = "payload.dd"
|
||||||
@@ -187,3 +213,13 @@ if(progStatus == False):
|
|||||||
print("Done")
|
print("Done")
|
||||||
else:
|
else:
|
||||||
print("Update your payload")
|
print("Update your payload")
|
||||||
|
|
||||||
|
led_state = False
|
||||||
|
while True:
|
||||||
|
if led_state:
|
||||||
|
led_pwm_up(led)
|
||||||
|
led_state = False
|
||||||
|
else:
|
||||||
|
led_pwm_down(led)
|
||||||
|
led_state = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user