2 Commits

3 changed files with 26 additions and 61 deletions

View File

@@ -50,7 +50,7 @@ Enter setup mode.
Copy boot.py to the root of the pico-ducky.
Copy your payload script to the pico-ducky.
Disconnect the pico from your host PC.
Connect a jumper wire between pin 18 (`GND`) and pin 20 (`GPIO15`).
Connect a jumper wire between pin 18 and pin 20.
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.
The default mode is USB mass storage enabled.
@@ -111,22 +111,6 @@ from keyboard_layout_win_LANG import KeyboardLayout
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
### Docs

View File

@@ -1,6 +1,10 @@
from board import *
import digitalio
import storage
import usb_hid
usb_hid.disable()
usb_hid.enable((usb_hid.Device.KEYBOARD,))
noStorageStatus = False
noStoragePin = digitalio.DigitalInOut(GP15)

View File

@@ -19,25 +19,8 @@ import supervisor
import time
import digitalio
from board import *
import pwmio
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
led = digitalio.DigitalInOut(LED)
led.direction = digitalio.Direction.OUTPUT
duckyCommands = {
'WINDOWS': Keycode.WINDOWS, 'GUI': Keycode.GUI,
@@ -126,7 +109,8 @@ supervisor.disable_autoreload()
# sleep at the start to allow the device to be recognized by the host computer
time.sleep(.5)
led_pwm_up(led)
led.value = True
def getProgrammingStatus():
# check GP0 for setup mode
@@ -143,22 +127,19 @@ def runScript(file):
global defaultDelay
duckyScriptPath = file
try:
f = open(duckyScriptPath,"r",encoding='utf-8')
previousLine = ""
for line in f:
line = line.rstrip()
if(line[0:6] == "REPEAT"):
for i in range(int(line[7:])):
#repeat the last command
parseLine(previousLine)
time.sleep(float(defaultDelay)/1000)
else:
parseLine(line)
previousLine = line
time.sleep(float(defaultDelay)/1000)
except OSError as e:
print("Unable to open file ", file)
f = open(duckyScriptPath,"r",encoding='utf-8')
previousLine = ""
for line in f:
line = line.rstrip()
if(line[0:6] == "REPEAT"):
for i in range(int(line[7:])):
#repeat the last command
parseLine(previousLine)
time.sleep(float(defaultDelay)/1000)
else:
parseLine(line)
previousLine = line
time.sleep(float(defaultDelay)/1000)
def selectPayload():
payload = "payload.dd"
@@ -214,12 +195,8 @@ if(progStatus == False):
else:
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
time.sleep(1.0)
led.value = False
time.sleep(1.0)
led.value = True