Giter Site home page Giter Site logo

xkbcat's Introduction

xkbcat

Simple X11 keylogger.

  • Simple output format: One line on stdout per key event.
  • Simple to audit: One short file of modern C.
  • Simple to run: Does not need sudo.

Examples

Keypresses only

Given no options, xkbcat prints only keypresses, one per line. Here's the output when I type "Hi":

Shift_L
h
i

Keypresses and key-ups

With key-ups enabled (xkbcat -up), the format changes to show them:

+Shift_L
+h
-h
-Shift_L
+i
-i

Lines starting + are key-downs; - are key-ups.

Compilation

Just make.

Don't have X11/extensions/XInput2.h? Install your distro's libxi-devel package.

Usage

Options you can pass (all optional):

  • -display <display>: set target X display (default :0)
  • -up: also prepend key-ups (default: don't)
  • -help: print usage hints and exit

Then just use your computer as usual. Interrupt signal (C-c) to quit.

Related programs

Other keyloggers

  • If you need to log keys across a whole Linux system (also in the framebuffer—not just in X11), try keysniffer. It works via a kernel module, and needs sudo.
  • If you want to see what characters the user actually typed (with modifier keys, backspace, etc resolved into text), xspy or logkeys might be better for you.

Programs that work well together with xkbcat

  • If you want to add timestamps to each line for logging purposes, I recommend piping to the moreutils package's ts. These answers feature various other tools good for the purpose.
  • If you only want to see key names when you press keys in the same terminal where xkbcat is running, you can temporarily disable terminal echo with stty -echo && xkbcat. (stty is in coreutils.)

Programs for logging other X11 events

  • xinput invoked as xinput --test-xi2 --root logs everything input-related; even mouse movements and clicks, and touchpad stuff. Its output is very comprehensive, but harder to parse.

  • If you need to log X11 events more generally, various protocol monitoring programs are listed in the X11 debugging guide.

Versioning

The git-tagged version numbers follow semver.

Error outputs (on stderr) are intended to be read by people. Changes to their wording are not considered breaking changes. Don't parse them programmatically.

License

ISC.

xkbcat's People

Contributors

anko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.