Enter Your Electronics & Design Project for a chance to win a $200 shopping cart! Back to homepage | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
The main idea was to use the Raspberry Pi Pico to emulate the keyboard and mouse to send random keys. I have used CircuitPython with additional usage of adafruit hid library. Below there is source code:
import random import usb_hid import time from adafruit_hid.consumer_control import ConsumerControl from adafruit_hid.consumer_control_code import ConsumerControlCode from adafruit_hid.keyboard import Keyboard from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS from adafruit_hid.mouse import Mouse kbd = Keyboard(usb_hid.devices) layout = KeyboardLayoutUS(kbd) m = Mouse(usb_hid.devices) cc = ConsumerControl(usb_hid.devices) while True: for x in range(random.randrange(15, 50)): kbd.send(random.randrange(32, 127)) m.click(Mouse.RIGHT_BUTTON) for x in range(random.randrange(5, 25)): m.move(random.randrange(-100, 100), random.randrange(-100, 100), random.randrange(-1,1)) cc.send(ConsumerControlCode.VOLUME_INCREMENT) time.sleep(random.randrange(5,30))
At the beginning there is initialization of keyboard and mouse devices. In main loop at the first stage there are sent few random key press. Then there is sent right mouse button click and few moves of mouse in to random position. At the end there is increasing of system volume and waiting at random delay to next loop. Of course it is easy to find due that the device is present and listed in system as mass storage device. Below there is short video where random keys or moves are send by Raspberry Pi Pico:
In similar way we could prank users of remote driven devices e.g. TV. In that case is required to use of IR diode connected to RPI Pico and send random key codes in one of popular standard for remote device e.g. RC-5.
Top Comments