Skip to content

Is there a way to code a text in bash and send to target computer using the OTG keyboard #826

Answered by mtlynch
wilsonnkwan asked this question in Q&A
Discussion options

You must be logged in to vote

It's possible, though we don't have great tooling around it in the community version.

From bash, you can run commands like the following to type "Hi" on the target system's keyboard:

# H (Right shift + h)
echo -ne "\x20\0\xb\0\0\0\0\0" > /dev/hidg0
# i
echo -ne "\0\0\xc\0\0\0\0\0" > /dev/hidg0
# Release all keys
echo -ne "\0\0\0\0\0\0\0\0" > /dev/hidg0

For more details, see: https://mtlynch.io/key-mime-pi/#usb-device-emulation

If you're interested in an Enterprise license, it includes a REST API for sending keystrokes programmatically.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wilsonnkwan
Comment options

@mtlynch
Comment options

Answer selected by mtlynch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #825 on November 24, 2021 14:01.