Skippy is a simple key hook for Windows, implemented in Go. It captures keystrokes and sends them through two channels. This document explains the purpose of each function in Skippy and provides instructions for using the program. This was Built for a game engine im working on.
-
SetWindowsHookEx(idHook int, lpfn uintptr, hmod uintptr, dwThreadId uint32) HHOOK
- Purpose: Sets a hook procedure to monitor keyboard events.
- Usage: Called to install a low-level keyboard hook that allows Skippy to capture keystrokes.
-
CallNextHookEx(hhk HHOOK, nCode int, wParam WPARAM, lParam LPARAM) LRESULT
- Purpose: Passes the hook information to the next hook procedure in the chain.
- Usage: Invoked within the
LowLevelKeyboardProc
function to ensure other hooks and applications receive the keyboard events.
-
LowLevelKeyboardProc(nCode int, wParam WPARAM, lParam LPARAM) LRESULT
- Purpose: Callback function that processes keyboard input events.
- Usage: Handles key presses, adjusts for Shift and Caps Lock states, and writes keystroke information to the log file.
-
getKeyState(vkCode int) int
- Purpose: Retrieves the state of a specific virtual key.
- Usage: Used in
LowLevelKeyboardProc
to determine whether keys like Shift or Caps Lock are pressed.
-
transform(s string, shift bool) string
- Purpose: Adjusts character output based on Shift and Caps Lock states.
- Usage: Converts characters to their shifted or non-shifted counterparts and handles special symbols.
-
UnhookWindowsHookEx(hhk HHOOK) bool
- Purpose: Removes the installed hook procedure.
- Usage: Not used in the current implementation but would typically be called to clean up the hook procedure when it is no longer needed.
-
Build the Program: Normally when you build the program in windows it opens a terminal window on startup. To prevent this we build the program as a GUI application
go build -ldflags="-H=windowsgui" -o skippy.exe main.go
-
Run Skippy
./skippy.exe
-
Handling Keys
- Skippy sends all captured keys through a two channels called 'valueChan' which outputs the key and 'vkodeChan' which outputs the key code
- Stopping the Program
- To stop Skippy, close the application window or terminate the process from the task manager.
- or add a killswitch
- Permissions: Ensure that you have appropriate permissions to run and access files on your system.
- Ethical Use: Use Skippy responsibly and only on machines where you have explicit permission to monitor keystrokes. Unauthorized use of keyloggers is illegal and unethical.