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)
Metadata
Release files for keybhook 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keybhook-0.10.tar.gz | 6.0 kB | Without provenance | Details for keybhook-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keybhook-0.10-py3-none-any.whl | Python 3 | none | any | Details for keybhook-0.10-py3-none-any.whl |
Total release size: 14.1 kB
Release files / keybhook-0.10.tar.gz
| Download URL | keybhook-0.10.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd7c6bfed52fa7e44ea0cc1049e338d26b1b0f9781587d445fb88be63d93266d
|
|
BLAKE2b-256 checksum How to use checksums |
86dffb708c0c623ab7f1c62d77388feab76f28ffbc23137908abd06c382bde36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / keybhook-0.10-py3-none-any.whl
| Download URL | keybhook-0.10-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d1685a68e7e16aa553ac651e58d1993113e75c7d2c961bb0d4e991e10f17e24
|
|
BLAKE2b-256 checksum How to use checksums |
686fd93970abf7f614cac5f67ca2873f774fd6190cc5a4cf5a86ba65841d6505
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for keybhook 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.