Basically, a ripoff of this: https://www.aidanwoods.com/blog/building-a-wifi-enabled-usb-rubber-ducky/
Tested on Raspberry Pi Zero W and a Windows 10 PC (version 1809).
- Started with a clean install of Raspbian Buster
- Used a Raspberry Pi 3 to setup wifi/keyboard/enable SSH/apt update etc.
- Then took SD card out and put into Pi Zero W and booted.
- SSHed into Pi and ran the following (after which the pi will power off):
curl -sSL https://raw.githubusercontent.com/raspberrypisig/pizero-usb-hid-keyboard/master/install.sh | sudo bash -
- When pi is off, remove power supply and use an ORDINARY(not OTG cable) microUSB to USB cable and plug it in to the USB connector marked USB on the board(the one next to the HDMI connector). Plug other end to Windows PC.
- Be patient, eventually Windows sees it as a Generic USB keyboard (ignore device malformed warnings)
- On Windows, open notepad
- Using another computer, I ssh'd into pi and ran
cd pizero-usb-hid-keyboard
echo 'left-shift h' | ./hid_gadget_test /dev/hidg0 keyboard
echo 'i' | ./hid_gadget_test /dev/hidg0 keyboard
or alternatively
/home/pi/pizero-usb-hid-keyboard/sendkeys.sh left-shift h
/home/pi/pizero-usb-hid-keyboard/sendkeys.sh i
- Success! Should see Hi in notepad
- Look at https://github.com/raspberrypisig/pizero-usb-hid-keyboard/blob/master/hid-gadget-test.c#L20 for what is possible.