KeyMe: Keystroke Injection Framework
 All Files Pages
HIDIScript
HIDIScript Generator

HIDIScript is a scripting language which allows users to perform full keyboard emulation. The HIDIScript Generator is available to make creating a HIDIScript payload even easier. Some keyboard keys cannot do not represent an typed character. For example, how do you instruct The Glitch to type in F4 or Alt in keyboard emulation. The answer is to use a language which The Glitch can interpret into those keys. That is where HIDIScript comes in. The script is loaded from the Micro SD card (just like the others) but it is interpreted by The Glitch at runtime.

HIDIScript used tags to represent keystrokes. There are three types of tags: Modifier Keys, Regular Keys, and Commands. Modifier Keys can be used together with a single Regular Key to produce a "new" keystroke. Regular Keys represent a single keystroke. Each Regular Key must be followed by a new line. Commands can be used to interact with the firmware through the script.

HIDIScript Generator

This web interface generates HIDIScript payloads for the KeyMe firmware on the The Glitch.

  • Simply type your desired plain text into the textbox.
  • When a non-typable character is needed (for example Fn+F4), click on a Key to insert into the textbox at the cursor point.
  • Some keys require additional user input. In order to save space in the menu, click on KEY_ when you need any printable character, including 0-9, A-Z and other non-alphanumeric keys. Type in all capital letters when inserting with KEY_.
  • Plaintext and Keys must be on separate lines to be parsed correctly.
  • Once you have created your script, copy and paste the content of the text box into a text editor and save the file.
  • For more information on HIDIScript visit here

    [CTRL]
    [ALT]
    [SHIFT]
    [GUI]
    [ENTER]
    [DELETE]
    [PRINTSCREEN]
    [BACKSPACE]
    [TAB]
    [SPACE]
    [CAPS_LOCK]
    [ESC]
    [SCROLL_LOCK]
    [NUM_LOCK]
    [INSERT]
    [HOME]
    [PAGE_UP]
    [END]
    [PAGE_DOWN]
    [RIGHT]
    [LEFT]
    [DOWN]
    [UP]
    [PAUSE]
    [LEFT_BRACE]
    [RIGHT_BRACE]
    [SPACE]
    [MINUS]
    [EQUAL]
    [PERIOD]
    [NUMBER]
    [SEMICOLON]
    [SLASH]
    [QUOTE]
    [TILDE]
    [COMMA]
    [CAPS_LOCK]
    [BACKSLASH]
    [F1]
    [F2]
    [F3]
    [F4]
    [F5]
    [F6]
    [F7]
    [F8]
    [F9]
    [F10]
    [F11]
    [F12]
    [WAIT_]
    [KEY_]


Syntax

  • Code sytax starts with '[' and ends with ']'
  • Lines may contain either plain text or HIDIScript tags.
  • Plain text will be typed out verbatim.
  • HIDIScript tags are parsed and interpreted as either a Regular Key, Modifier Key, or Command
  • Each line using HIDIScript tags may contain only a single keystroke or command. Modifier Keys may be used in conjunction with each other and a single Regular Key to create a single keystroke. For example: [KEY_CTRL][KEY_S]. The combination of the keys is used to form Ctrl+S, which is used by most operating systems to "save" a file.
  • Command Keys are instructions for the firmware and are not interpreted as keystrokes.



The following tables contain the syntax for the HIDIScript language.



Regular Keys Codes

KEY_AKEY_BKEY_CKEY_D
KEY_EKEY_FKEY_GKEY_H
KEY_IKEY_JKEY_KKEY_L
KEY_MKEY_NKEY_OKEY_P
KEY_QKEY_RKEY_SKEY_T
KEY_UKEY_VKEY_WKEY_X
KEY_YKEY_ZKEY_1KEY_2
KEY_3KEY_4KEY_5KEY_6
KEY_7KEY_8KEY_9KEY_0
KEY_ENTERKEY_ESCKEY_BACKSPACEKEY_TAB
KEY_SPACEKEY_MINUSKEY_EQUALKEY_LEFT_BRACE
KEY_RIGHT_BRACEKEY_BACKSLASHKEY_NUMBERKEY_SEMICOLON
KEY_QUOTEKEY_TILDEKEY_COMMAKEY_PERIOD
KEY_SLASHKEY_CAPS_LOCKKEY_F1KEY_F2
KEY_F3KEY_F4KEY_F5KEY_F6
KEY_F7KEY_F8KEY_F9KEY_F10
KEY_F11KEY_F12KEY_PRINTSCREENKEY_SCROLL_LOCK
KEY_PAUSEKEY_INSERTKEY_HOMEKEY_PAGE_UP
KEY_DELETEKEY_ENDKEY_PAGE_DOWNKEY_RIGHT
KEY_LEFTKEY_DOWNKEY_UPKEY_NUM_LOCK
KEYPAD_SLASHKEYPAD_ASTERIXKEYPAD_MINUSKEYPAD_PLUS
KEYPAD_ENTERKEYPAD_1KEYPAD_2KEYPAD_3
KEYPAD_4KEYPAD_5KEYPAD_6KEYPAD_7
KEYPAD_8KEYPAD_9KEYPAD_0KEYPAD_PERIOD



Modifier Keys

KEY_CTRLKEY_SHIFTKEY_ALTKEY_GUI



Commands

WAIT_#Delay '#' number of milliseconds.




Code Example

The following is the "Hello World" of keystroke injection on Windows. It opens up Notepad from the Windows runbar and types in "Hello World", then kills the notepad application. In between, time delays are used to wait on the target system to complete the task.

[KEY_GUI][KEY_R]
[WAIT_1000]
notepad
[KEY_ENTER]
[WAIT_2000]
Hello World
[KEY_ENTER]
[WAIT_2000]
[KEY_ALT][KEY_F4]
[WAIT_500]
[KEY_ALT][KEY_N]

Written by Ben Weinstein-Raun