Skip to content
/ keyid Public

Python module to check for an expected number of keyboards on a system, useful to detect when you're getting facedanced...

Notifications You must be signed in to change notification settings

attwad/keyid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

KeyInjectionDetector

Python module to check for an expected number of keyboards on a system, useful to detect when you're getting facedanced...

Usage

If you expect to have 2 keyboards on your system and you indeed have 2 keyboards connected:

  > python check_num_keyboards.py 2
  found 5 devices on this system
  Got info on all those devices:
  hDevice: 131141
  dwType:  2
  HID, not mouse nor keyboard
  hDevice: 65603
  dwType:  1
  KEYBOARD
  hDevice: 720961
  dwType:  1
  KEYBOARD
  hDevice: 65599
  dwType:  0
  MOUSE
  hDevice: 720957
  dwType:  0
  MOUSE
  Found 2 keyboard(s) on this system

But if you don't have the expected number of keyboards on your system, an alert popup will be shown.

I suggest setting up a scheduled task on windows using something like:

schtasks /create /sc minute /mo 1 /tn "Check num keyboards" /tr C:\keyid\run.bat

Linux

To come, but if you're using linux there are much easier ways to check for this kind of things, no need for python nor ctypes, just plain old bash foo will do up to some point:

> test 5 -eq $(xinput list | grep "slave keyboard" | wc -l) && echo ok || notify-send "SUSPICIOUS NUMBER OF KEYBOARDS" "$(xinput list | grep ' keyboard (' | cut -f1)" -u CRITICAL

About

Python module to check for an expected number of keyboards on a system, useful to detect when you're getting facedanced...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages