Just a little keylogger
Project description
Just a little keylogger
pip install keybhook
Tested against Windows 10 / Python 3.10 / Anaconda
This script allows you to hook into the Windows keyboard events and capture the keys that are pressed on the keyboard.
How to use it
from keybhook import start_hook, config, VK_CODELETTER
VK_CODELETTER[193] = ('?', False) # adds not mapped chars (https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes), on my keyboard "?" has the code 193 -
it might be different on yours. (2nd value: True if numpad else False)
config.done = False
start_hook()
# example
oldlen = 0
co = 0
while True:
newlen = len(config.results)
if newlen > oldlen:
print(config.results[-1]) # prints the last captured letter
co += 1
oldlen = newlen
if co == 20:
config.done # break when we have 20 characters
break
#
#
#
# ('letter', 'is_numpad', 'event_code', 'event', 'scan_code', 'flags', 'time')
# ('enter', False, 257, 'KEY_UP', 28, 129, 87485609)
# ('right shift', False, 256, 'KEY_DOWN', 54, 1, 87486906)
# ('h', False, 256, 'KEY_DOWN', 35, 0, 87487062)
# ('h', False, 257, 'KEY_UP', 35, 128, 87487125)
# ('right shift', False, 257, 'KEY_UP', 54, 129, 87487156)
# ('e', False, 256, 'KEY_DOWN', 18, 0, 87487234)
# ('e', False, 257, 'KEY_UP', 18, 128, 87487328)
# ('l', False, 256, 'KEY_DOWN', 38, 0, 87487500)
# ('l', False, 257, 'KEY_UP', 38, 128, 87487593)
# ('l', False, 256, 'KEY_DOWN', 38, 0, 87487640)
# ('l', False, 257, 'KEY_UP', 38, 128, 87487718)
# ('o', False, 256, 'KEY_DOWN', 24, 0, 87487796)
# ('o', False, 257, 'KEY_UP', 24, 128, 87487890)
# ('right shift', False, 256, 'KEY_DOWN', 54, 1, 87488156)
# ('?', False, 256, 'KEY_DOWN', 115, 0, 87488359)
# ('?', False, 257, 'KEY_UP', 115, 128, 87488500)
# ('right shift', False, 257, 'KEY_UP', 54, 129, 87488515)
# ('spacebar', False, 256, 'KEY_DOWN', 57, 0, 87490890)
# ('spacebar', False, 257, 'KEY_UP', 57, 128, 87491000)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
keybhook-0.10.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file keybhook-0.10.tar.gz
.
File metadata
- Download URL: keybhook-0.10.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd7c6bfed52fa7e44ea0cc1049e338d26b1b0f9781587d445fb88be63d93266d |
|
MD5 | 361ea8b520b10bbee56760bb755f21de |
|
BLAKE2b-256 | 86dffb708c0c623ab7f1c62d77388feab76f28ffbc23137908abd06c382bde36 |
File details
Details for the file keybhook-0.10-py3-none-any.whl
.
File metadata
- Download URL: keybhook-0.10-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d1685a68e7e16aa553ac651e58d1993113e75c7d2c961bb0d4e991e10f17e24 |
|
MD5 | 8ccc9b01a5ad8500f38ccb9b70bfd9c3 |
|
BLAKE2b-256 | 686fd93970abf7f614cac5f67ca2873f774fd6190cc5a4cf5a86ba65841d6505 |