Git Product home page Git Product logo

kiri's Introduction

KIRI - Keyboard Interception, Remapping and Injection using Raspberry Pi as a HID Proxy.

Near limitless abilities for a keyboard warrior.

Features

  • Simple remap of any key or key combination to any key or key combination.
  • Build keyboard mapping and/or macros using python.
  • Completely external and thereby supports any operating system capable of receiving keyboard input via USB.

Hardware Requirements

  • A Raspberry Pi with an USB OTG port (e.g. Pi 4 and Zero W) - this is required so the Raspberry Pi may identify itself as a Human Interface Device (HID).
  • An additional USB port for keyboard input to the Raspberri Pi. Only if using a bluetooth keyboard the Raspberri Pi Zero W will suffice, otherwise a Raspberri Pi 4 is needed.

OS Requirements

  • Testing has only been conducted with Raspberrian OS - other distributions may work also.
  • For convenience and later modifications one can enable sshd on the raspberry pi and connect it to e.g. WiFi-LAN.

Software Requirements

  • python >= 3.4 with evdev and importlib installed (pip3 install evdev importlib)

Install

Enable USB OTG via the dwc2 module and allow us to register a HID device in non-kernel mode

sudo -i
echo "dtoverlay=dwc2" | tee -a /boot/config.txt
echo "dwc2" | tee -a /etc/modules
echo "libcomposite" | tee -a /etc/modules

Add binary to PATH:

sudo ln -s /root/kiri/kiri_usb /usr/bin

Modify /etc/rc.local to call the script on boot.

nano /etc/rc.local

Insert the following before exit 0.

/usr/bin/kiri_usb

Reboot the device.

reboot

After reboot, verify that /dev/hidg0 exists.

ls /dev/hidg0

The Raspberry Pi is now setup so e.g. a python script can write USB reports to the USB OTG port by simply writing to /dev/hidg0.

Installing KIRI

  1. Using git, checkout to a folder accessible by a super-user, e.g. /root/kiri.
    or
  2. Copy the files of this repository to e.g. /root/kiri
  3. You should now have a file with the following path: /root/kiri/kiri.py on the raspberry pi.

Set up a service or e.g. crontab to run kiri.py on boot as a super-user (e.g. root).

Example with crontab

sudo -i
crontab -e

Add the following line

@reboot python3 /root/kiri/kiri.py >>/var/log/kiri.log

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.