Mitmgate v0.0.0+dev.3
Man in the Middle Keylogger and Injector
Loading...
Searching...
No Matches
MITMGATE: USB HID Simulation & Parsing Logic

Welcome to the MITMGATE technical documentation. This project implements a Hardware Abstraction Layer (HAL) to process USB HID keyboard packets, currently operating in a Windows hosted simulation environment.

1. Project Architecture

The codebase is strictly divided between portable core logic and platform specific simulation to ensure a future proof design.

  • Core Logic (src/core/): Hardware agnostic HID parsing. These files are designed to be moved to an STM32/embedded target without modification.
    • hid_tables.h: Definitions for HID usage IDs and ASCII mapping.
    • typedef.h: Fixed width integer types and packet structures.
  • Virtual Layer (src/virtual/): Simulates physical hardware.
    • virtual_keyboard.c: Mocks the USB data stream using static arrays (MOCK_DATA) to bypass Windows driver exclusive locking.
  • Application (src/main.c): The main processing loop that orchestrates data ingestion and parsing.

2. Data Pipeline

The application follows a linear ingestion to output pipeline:

  1. Ingest: usb_keyboard_read_packet() retrieves an 8 byte hid_keyboard_packet_t.
  2. Debounce: Compares current packets against previous states to detect state changes.
  3. Parse: hid_parse_key() translates the HID modifier and keycode into a displayable ASCII character.
  4. Output: Results are streamed to the standard output.

3. Build System

This project utilizes the Ninja build system with a Unity Build strategy for maximum compilation speed.

Prerequisites

  • Compiler: MSVC (cl.exe) or MinGW (gcc).
  • Build Tool: Ninja.

Commands

To compile the project and update documentation:

# Compile the executable
ninja
# Generate/Update Doxygen HTML
doxygen Doxyfile
# Run the simulator
.\build\keylogger.exe

4. Documentation Guide

Detailed API references, including function parameters and data structures, can be found in the Files and Classes tabs.

  • See hid_tables.h for the HID-to-ASCII lookup implementation.
  • See virtual_keyboard.c for details on how the HID packet stream is simulated.

Generated by Doxygen for the MITMGATE Project.