mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Pico2 support (#299)
* Add support for Pico2/2W boards * Update documentation to include Pico2/2W * update language support
This commit is contained in:
22
README.md
22
README.md
@@ -27,11 +27,19 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
|
|||||||
|
|
||||||
If using a Pico board:
|
If using a Pico board:
|
||||||
|
|
||||||
Copy the adafruit-circuitpython-raspberry_pi_pico-en_US-8.0.0.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
Copy the adafruit-circuitpython-raspberry_pi_pico-en_US-9.2.1.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
||||||
|
|
||||||
If using a Pico W board:
|
If using a Pico W board:
|
||||||
|
|
||||||
Copy the adafruit-circuitpython-raspberry_pi_pico_w-en_US-8.0.0.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
Copy the adafruit-circuitpython-raspberry_pi_pico_w-en_US-9.2.1.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
||||||
|
|
||||||
|
If using a Pico 2 board:
|
||||||
|
|
||||||
|
Copy the adafruit-circuitpython-raspberry_pi_pico2-en_US-9.2.1.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
||||||
|
|
||||||
|
If using a Pico 2W board:
|
||||||
|
|
||||||
|
Copy the adafruit-circuitpython-raspberry_pi_pico2_w-en_US-9.2.1.uf2 file to the root of the Pico (RPI-RP2). The device will reboot and after a second or so, it will reconnect as CIRCUITPY.
|
||||||
|
|
||||||
4. Copy the lib folder to the root of the CIRCUITPY
|
4. Copy the lib folder to the root of the CIRCUITPY
|
||||||
|
|
||||||
@@ -76,14 +84,16 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
|
|||||||
|
|
||||||
1. Clone the repo to get a local copy of the files. `git clone https://github.com/dbisu/pico-ducky.git`
|
1. Clone the repo to get a local copy of the files. `git clone https://github.com/dbisu/pico-ducky.git`
|
||||||
|
|
||||||
2. Download [CircuitPython for the Raspberry Pi Pico](https://circuitpython.org/board/raspberry_pi_pico/). *Updated to 8.0.0
|
2. Download [CircuitPython for the Raspberry Pi Pico](https://circuitpython.org/board/raspberry_pi_pico/). *Updated to 9.2.1
|
||||||
Download [CircuitPython for the Raspberry Pi Pico W](https://circuitpython.org/board/raspberry_pi_pico_w/). *Updated to 8.0.0
|
Download [CircuitPython for the Raspberry Pi Pico W](https://circuitpython.org/board/raspberry_pi_pico_w/). *Updated to 9.2.1
|
||||||
|
Download [CircuitPython for the Raspberry Pi Pico 2](https://circuitpython.org/board/raspberry_pi_pico2/). *Updated to 9.2.1
|
||||||
|
Download [CircuitPython for the Raspberry Pi Pico 2W](https://circuitpython.org/board/raspberry_pi_pico2_w/). *Updated to 9.2.1
|
||||||
|
|
||||||
3. Plug the device into a USB port while holding the boot button. It will show up as a removable media device named `RPI-RP2`.
|
3. Plug the device into a USB port while holding the boot button. It will show up as a removable media device named `RPI-RP2`.
|
||||||
|
|
||||||
4. Copy the downloaded `.uf2` file to the root of the Pico (`RPI-RP2`). The device will reboot and after a second or so, it will reconnect as `CIRCUITPY`.
|
4. Copy the downloaded `.uf2` file to the root of the Pico (`RPI-RP2`). The device will reboot and after a second or so, it will reconnect as `CIRCUITPY`.
|
||||||
|
|
||||||
5. Download `adafruit-circuitpython-bundle-8.x-mpy-YYYYMMDD.zip` [here](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest) and extract it outside the device.
|
5. Download `adafruit-circuitpython-bundle-9.x-mpy-YYYYMMDD.zip` [here](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest) and extract it outside the device.
|
||||||
|
|
||||||
6. Navigate to `lib` in the recently extracted folder and copy `adafruit_hid` to the `lib` folder on your Raspberry Pi Pico.
|
6. Navigate to `lib` in the recently extracted folder and copy `adafruit_hid` to the `lib` folder on your Raspberry Pi Pico.
|
||||||
|
|
||||||
@@ -100,7 +110,7 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
|
|||||||
12. *For Pico W Only* Create the file `secrets.py` in the root of the Pico W. This contains the AP name and password to be created by the Pico W.
|
12. *For Pico W Only* Create the file `secrets.py` in the root of the Pico W. This contains the AP name and password to be created by the Pico W.
|
||||||
`secrets = { 'ssid' : "BadAPName", 'password' : "badpassword" }`
|
`secrets = { 'ssid' : "BadAPName", 'password' : "badpassword" }`
|
||||||
|
|
||||||
13. Find a script [here](https://github.com/hak5/usbrubberducky-payloads) or [create your own one using Ducky Script](https://docs.hak5.org/hak5-usb-rubber-ducky/ducky-script-basics/hello-world) and save it as `payload.dd` in the Pico. Currently, pico-ducky only supports DuckyScript 1.0, not 3.0.
|
13. Find a script [here](https://github.com/hak5/usbrubberducky-payloads) or [create your own one using Ducky Script](https://docs.hak5.org/hak5-usb-rubber-ducky/ducky-script-basics/hello-world) and save it as `payload.dd` in the Pico. Currently, pico-ducky only supports DuckyScript 1.0, and some of 3.0.
|
||||||
|
|
||||||
14. Be careful, if your device isn't in [setup mode](#setup-mode), the device will reboot and after half a second, the script will run.
|
14. Be careful, if your device isn't in [setup mode](#setup-mode), the device will reboot and after half a second, the script will run.
|
||||||
|
|
||||||
|
|||||||
4
boot.py
4
boot.py
@@ -24,10 +24,10 @@ noStorageStatus = noStoragePin.value
|
|||||||
# GP15 not connected == USB NOT visible
|
# GP15 not connected == USB NOT visible
|
||||||
# GP15 connected to GND == USB visible
|
# GP15 connected to GND == USB visible
|
||||||
|
|
||||||
if(board.board_id == 'raspberry_pi_pico'):
|
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
|
||||||
# On Pi Pico, default to USB visible
|
# On Pi Pico, default to USB visible
|
||||||
noStorage = not noStorageStatus
|
noStorage = not noStorageStatus
|
||||||
elif(board.board_id == 'raspberry_pi_pico_w'):
|
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||||
# on Pi Pico W, default to USB hidden by default
|
# on Pi Pico W, default to USB hidden by default
|
||||||
# so webapp can access storage
|
# so webapp can access storage
|
||||||
noStorage = noStorageStatus
|
noStorage = noStorageStatus
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ languages = [ "MAC_FR",
|
|||||||
"WIN_IT",
|
"WIN_IT",
|
||||||
"WIN_PO",
|
"WIN_PO",
|
||||||
"WIN_SW",
|
"WIN_SW",
|
||||||
"WIN_TR" ]
|
"WIN_TR",
|
||||||
|
"WIN_UK" ]
|
||||||
|
|
||||||
supported_boards = ["raspberry_pi_pico",
|
supported_boards = ["raspberry_pi_pico",
|
||||||
"raspberry_pi_pico_w",
|
"raspberry_pi_pico_w",
|
||||||
|
|||||||
8
code.py
8
code.py
@@ -12,7 +12,7 @@ import digitalio
|
|||||||
from board import *
|
from board import *
|
||||||
import board
|
import board
|
||||||
from duckyinpython import *
|
from duckyinpython import *
|
||||||
if(board.board_id == 'raspberry_pi_pico_w'):
|
if(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||||
import wifi
|
import wifi
|
||||||
from webapp import *
|
from webapp import *
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ def startWiFi():
|
|||||||
#supervisor.disable_autoreload()
|
#supervisor.disable_autoreload()
|
||||||
supervisor.runtime.autoreload = False
|
supervisor.runtime.autoreload = False
|
||||||
|
|
||||||
if(board.board_id == 'raspberry_pi_pico'):
|
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
|
||||||
led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)
|
led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)
|
||||||
elif(board.board_id == 'raspberry_pi_pico_w'):
|
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||||
led = digitalio.DigitalInOut(board.LED)
|
led = digitalio.DigitalInOut(board.LED)
|
||||||
led.switch_to_output()
|
led.switch_to_output()
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ async def main_loop():
|
|||||||
global led,button1
|
global led,button1
|
||||||
|
|
||||||
button_task = asyncio.create_task(monitor_buttons(button1))
|
button_task = asyncio.create_task(monitor_buttons(button1))
|
||||||
if(board.board_id == 'raspberry_pi_pico_w'):
|
if(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||||
pico_led_task = asyncio.create_task(blink_pico_w_led(led))
|
pico_led_task = asyncio.create_task(blink_pico_w_led(led))
|
||||||
print("Starting Wifi")
|
print("Starting Wifi")
|
||||||
startWiFi()
|
startWiFi()
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ def runScript(file):
|
|||||||
previousLine = ""
|
previousLine = ""
|
||||||
for line in script_lines:
|
for line in script_lines:
|
||||||
print(f"runScript: {line}")
|
print(f"runScript: {line}")
|
||||||
|
|
||||||
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
|
||||||
@@ -214,7 +214,7 @@ def runScript(file):
|
|||||||
time.sleep(float(defaultDelay) / 1000)
|
time.sleep(float(defaultDelay) / 1000)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print("Unable to open file", file)
|
print("Unable to open file", file)
|
||||||
|
|
||||||
def selectPayload():
|
def selectPayload():
|
||||||
global payload1Pin, payload2Pin, payload3Pin, payload4Pin
|
global payload1Pin, payload2Pin, payload3Pin, payload4Pin
|
||||||
payload = "payload.dd"
|
payload = "payload.dd"
|
||||||
@@ -249,9 +249,9 @@ def selectPayload():
|
|||||||
|
|
||||||
async def blink_led(led):
|
async def blink_led(led):
|
||||||
print("Blink")
|
print("Blink")
|
||||||
if(board.board_id == 'raspberry_pi_pico'):
|
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
|
||||||
blink_pico_led(led)
|
blink_pico_led(led)
|
||||||
elif(board.board_id == 'raspberry_pi_pico_w'):
|
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||||
blink_pico_w_led(led)
|
blink_pico_w_led(led)
|
||||||
|
|
||||||
async def blink_pico_led(led):
|
async def blink_pico_led(led):
|
||||||
|
|||||||
Reference in New Issue
Block a user