Setting Up A Keylogger In Rust
This does mouse and keyboard
This is straight from the home page example:
Code
use device_query::{DeviceEvents, DeviceState};
fn main() {
let device_state = DeviceState::new();
let _guard = device_state.on_mouse_move(|position| {
println!("Mouse position: {:#?}", position);
});
let _guard = device_state.on_mouse_down(|button| {
println!("Mouse button down: {:#?}", button);
});
let _guard = device_state.on_mouse_up(|button| {
println!("Mouse button up: {:#?}", button);
});
let _guard = device_state.on_key_down(|key| {
println!("Keyboard key down: {:#?}", key);
});
let _guard = device_state.on_key_up(|key| {
println!("Keyboard key up: {:#?}", key);
});
loop {}
}