Mitmgate
v0.0.0+dev.3
Man in the Middle Keylogger and Injector
Loading...
Searching...
No Matches
HID Keyboard Protocol Reference
* # HID Report Map (8-Byte Packet)
* The
hid_keyboard_packet_t
struct represents the standard 8-byte input report
sent by most USB keyboards.
* | Byte | Name | Description |
|---—|------------—|--------------------------------------------------—|
| 0 | Modifiers | Bitmask for Shift, Ctrl, Alt, GUI keys. |
| 1 | Reserved | Always 0x00 (per HID spec). |
| 2-7 | Key Arrays | Up to 6 simultaneous keypresses (NKRO). |
* ## Modifier Bitmask Table
These bits are checked in
hid_parse_key()
to determine if a character
should be capitalized or shifted (e.g., '1' vs '!').
* | Bit | Key | Hex Value |
|--—|------------—|--------—|
| 0 | Left Ctrl |
0x01
|
| 1 | Left Shift |
0x02
|
| 2 | Left Alt |
0x04
|
| 3 | Left GUI |
0x08
|
| 4 | Right Ctrl |
0x10
|
| 5 | Right Shift |
0x20
|
*
* # Usage IDs vs. ASCII
It is important to note that the values in bytes 2-7 are
Usage IDs
, not
ASCII values.
- Usage ID
0x04
= 'a' or 'A'
- Usage ID
0x1E
= '1' or '!'
* The mapping logic is handled by the lookup table in
hid_tables.h
.
* # Simulation Behavior
In the Windows simulation (
virtual_keyboard.c
), we simulate "Key Up" events
by sending a "Null Packet":
00 00 00 00 00 00 00 00
* Without these null packets, the parser would think a key is being held down
indefinitely (Repeating Keys). */
Generated by
1.16.1