keylogger

package module
v0.0.0-...-337a115 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2022 License: ISC Imports: 4 Imported by: 0

README

go-keylogger

GoDoc

This is a small go keylogger library for Windows. It has the advantage over all the other keyloggers I found that it correctly parses each keypress, no matter the keyboard layout. No keymaps are hard-coded.

See the examples/ directory for examples.

Currently, the lib polls for keypresses every X milliseconds and checks the entire keyboard using GetAsyncKeyState(), which is not the optimal solution but it works well. Work is going on in the win-events branch to convert the lib to use the Windows events instead of polling.

Documentation

Overview

Package keylogger is a keylogger for windows

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Empty   bool
	Rune    rune
	Keycode int
}

Key is a single key entered by the user

type Keylogger

type Keylogger struct {
	// contains filtered or unexported fields
}

Keylogger represents the keylogger

func NewKeylogger

func NewKeylogger() Keylogger

NewKeylogger creates a new keylogger depending on the platform we are running on (currently only Windows is supported)

func (*Keylogger) GetKey

func (kl *Keylogger) GetKey() Key

GetKey gets the current entered key by the user, if there is any

func (Keylogger) ParseKeycode

func (kl Keylogger) ParseKeycode(keyCode int, keyState uint16) Key

ParseKeycode returns the correct Key struct for a key taking in account the current keyboard settings That struct contains the Rune for the key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL