Skip to content

Commit 8b11882

Browse files
authored
Pico2 support (#299)
* Add support for Pico2/2W boards * Update documentation to include Pico2/2W * update language support
1 parent 8bcd2aa commit 8b11882

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

README.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,19 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
2727

2828
If using a Pico board:
2929

30-
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.
30+
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.
3131

3232
If using a Pico W board:
3333

34-
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.
34+
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.
35+
36+
If using a Pico 2 board:
37+
38+
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.
39+
40+
If using a Pico 2W board:
41+
42+
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.
3543

3644
4. Copy the lib folder to the root of the CIRCUITPY
3745

@@ -76,14 +84,16 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
7684

7785
1. Clone the repo to get a local copy of the files. `git clone https://github.com/dbisu/pico-ducky.git`
7886

79-
2. Download [CircuitPython for the Raspberry Pi Pico](https://circuitpython.org/board/raspberry_pi_pico/). *Updated to 8.0.0
80-
Download [CircuitPython for the Raspberry Pi Pico W](https://circuitpython.org/board/raspberry_pi_pico_w/). *Updated to 8.0.0
87+
2. Download [CircuitPython for the Raspberry Pi Pico](https://circuitpython.org/board/raspberry_pi_pico/). *Updated to 9.2.1
88+
Download [CircuitPython for the Raspberry Pi Pico W](https://circuitpython.org/board/raspberry_pi_pico_w/). *Updated to 9.2.1
89+
Download [CircuitPython for the Raspberry Pi Pico 2](https://circuitpython.org/board/raspberry_pi_pico2/). *Updated to 9.2.1
90+
Download [CircuitPython for the Raspberry Pi Pico 2W](https://circuitpython.org/board/raspberry_pi_pico2_w/). *Updated to 9.2.1
8191

8292
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`.
8393

8494
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`.
8595

86-
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.
96+
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.
8797

8898
6. Navigate to `lib` in the recently extracted folder and copy `adafruit_hid` to the `lib` folder on your Raspberry Pi Pico.
8999

@@ -100,7 +110,7 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
100110
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.
101111
`secrets = { 'ssid' : "BadAPName", 'password' : "badpassword" }`
102112

103-
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.
113+
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.
104114

105115
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.
106116

boot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
# GP15 not connected == USB NOT visible
2525
# GP15 connected to GND == USB visible
2626

27-
if(board.board_id == 'raspberry_pi_pico'):
27+
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
2828
# On Pi Pico, default to USB visible
2929
noStorage = not noStorageStatus
30-
elif(board.board_id == 'raspberry_pi_pico_w'):
30+
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
3131
# on Pi Pico W, default to USB hidden by default
3232
# so webapp can access storage
3333
noStorage = noStorageStatus

build_scripts/create_release_bundle.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"WIN_IT",
1818
"WIN_PO",
1919
"WIN_SW",
20-
"WIN_TR" ]
20+
"WIN_TR",
21+
"WIN_UK" ]
2122

2223
supported_boards = ["raspberry_pi_pico",
2324
"raspberry_pi_pico_w",

code.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from board import *
1313
import board
1414
from duckyinpython import *
15-
if(board.board_id == 'raspberry_pi_pico_w'):
15+
if(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
1616
import wifi
1717
from webapp import *
1818

@@ -41,9 +41,9 @@ def startWiFi():
4141
#supervisor.disable_autoreload()
4242
supervisor.runtime.autoreload = False
4343

44-
if(board.board_id == 'raspberry_pi_pico'):
44+
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
4545
led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)
46-
elif(board.board_id == 'raspberry_pi_pico_w'):
46+
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
4747
led = digitalio.DigitalInOut(board.LED)
4848
led.switch_to_output()
4949

@@ -68,7 +68,7 @@ async def main_loop():
6868
global led,button1
6969

7070
button_task = asyncio.create_task(monitor_buttons(button1))
71-
if(board.board_id == 'raspberry_pi_pico_w'):
71+
if(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
7272
pico_led_task = asyncio.create_task(blink_pico_w_led(led))
7373
print("Starting Wifi")
7474
startWiFi()

duckyinpython.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def runScript(file):
202202
previousLine = ""
203203
for line in script_lines:
204204
print(f"runScript: {line}")
205-
205+
206206
if(line[0:6] == "REPEAT"):
207207
for i in range(int(line[7:])):
208208
#repeat the last command
@@ -214,7 +214,7 @@ def runScript(file):
214214
time.sleep(float(defaultDelay) / 1000)
215215
except OSError as e:
216216
print("Unable to open file", file)
217-
217+
218218
def selectPayload():
219219
global payload1Pin, payload2Pin, payload3Pin, payload4Pin
220220
payload = "payload.dd"
@@ -249,9 +249,9 @@ def selectPayload():
249249

250250
async def blink_led(led):
251251
print("Blink")
252-
if(board.board_id == 'raspberry_pi_pico'):
252+
if(board.board_id == 'raspberry_pi_pico' or board.board_id == 'raspberry_pi_pico2'):
253253
blink_pico_led(led)
254-
elif(board.board_id == 'raspberry_pi_pico_w'):
254+
elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
255255
blink_pico_w_led(led)
256256

257257
async def blink_pico_led(led):

0 commit comments

Comments
 (0)