Mitmgate v0.0.0+dev.3
Man in the Middle Keylogger and Injector
Loading...
Searching...
No Matches
usb_keyboard.c File Reference

Win32 Implementation of USB Keyboard Simulation. More...

#include "../../core/usb_keyboard.h"
#include <stdio.h>
#include <string.h>
#include <windows.h>

Classes

struct  raw_packet
 Helper structure for defining raw byte packets in mock data. More...

Functions

int usb_keyboard_init (void)
 Initializes the Win32 virtual keyboard driver.
int usb_keyboard_read_packet (hid_keyboard_packet *out_packet)
 Reads the next packet from the Mock Data array.
void usb_keyboard_cleanup (void)
 Cleans up the Win32 virtual keyboard driver.

Detailed Description

Win32 Implementation of USB Keyboard Simulation.

This implementation uses a mock data stream to simulate incoming USB HID packets for testing the MITM logic without physical hardware.

@platform Windows (Win32)

Function Documentation

◆ usb_keyboard_cleanup()

void usb_keyboard_cleanup ( void )

Cleans up the Win32 virtual keyboard driver.

Cleans up resources and disconnects the keyboard subsystem.

◆ usb_keyboard_init()

int usb_keyboard_init ( void )

Initializes the Win32 virtual keyboard driver.

Initializes the keyboard subsystem.

Resets the mock data index to the beginning.

Returns
int Always returns USB_OK.

◆ usb_keyboard_read_packet()

int usb_keyboard_read_packet ( hid_keyboard_packet * out_packet)

Reads the next packet from the Mock Data array.

Reads a single HID packet from the input stream.

Simulates a USB polling delay using Sleep(100).

Parameters
out_packetDestination for the key data.
Returns
int USB_OK on success, USB_END_OF_STREAM when data is exhausted.