mirror of
https://github.com/dbisu/pico-ducky.git
synced 2026-01-21 17:26:00 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6de3e98dc | ||
|
|
018fce3592 |
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 (`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.
|
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,22 +111,6 @@ 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
|
||||||
|
|||||||
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)
|
||||||
|
|||||||
@@ -19,25 +19,8 @@ import supervisor
|
|||||||
import time
|
import time
|
||||||
import digitalio
|
import digitalio
|
||||||
from board import *
|
from board import *
|
||||||
import pwmio
|
led = digitalio.DigitalInOut(LED)
|
||||||
|
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,
|
||||||
@@ -126,7 +109,8 @@ 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)
|
led.value = True
|
||||||
|
|
||||||
|
|
||||||
def getProgrammingStatus():
|
def getProgrammingStatus():
|
||||||
# check GP0 for setup mode
|
# check GP0 for setup mode
|
||||||
@@ -143,22 +127,19 @@ def runScript(file):
|
|||||||
global defaultDelay
|
global defaultDelay
|
||||||
|
|
||||||
duckyScriptPath = file
|
duckyScriptPath = file
|
||||||
try:
|
f = open(duckyScriptPath,"r",encoding='utf-8')
|
||||||
f = open(duckyScriptPath,"r",encoding='utf-8')
|
previousLine = ""
|
||||||
previousLine = ""
|
for line in f:
|
||||||
for line in f:
|
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:])):
|
#repeat the last command
|
||||||
#repeat the last command
|
parseLine(previousLine)
|
||||||
parseLine(previousLine)
|
time.sleep(float(defaultDelay)/1000)
|
||||||
time.sleep(float(defaultDelay)/1000)
|
else:
|
||||||
else:
|
parseLine(line)
|
||||||
parseLine(line)
|
previousLine = line
|
||||||
previousLine = line
|
time.sleep(float(defaultDelay)/1000)
|
||||||
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"
|
||||||
@@ -214,12 +195,8 @@ if(progStatus == False):
|
|||||||
else:
|
else:
|
||||||
print("Update your payload")
|
print("Update your payload")
|
||||||
|
|
||||||
led_state = False
|
|
||||||
while True:
|
while True:
|
||||||
if led_state:
|
time.sleep(1.0)
|
||||||
led_pwm_up(led)
|
led.value = False
|
||||||
led_state = False
|
time.sleep(1.0)
|
||||||
else:
|
led.value = True
|
||||||
led_pwm_down(led)
|
|
||||||
led_state = True
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user