1

This is a simple keylogger using python. The problem is, whether I use lower case letter or upper case letter, it shows the letter in upper case.

import pythoncom
import pyHook


def keyboard_logger (keyEvet):

    print chr(keyEvet.Ascii)

if(__name__ == '__main__'):

    event = pyHook.HookManager()

    event.KeyDown = keyboard_logger
    event.HookKeyboard()

    pythoncom.PumpMessages()

For Example:

When I press 'a' it prints 'A'.

when I press 'A' it prints 'A'.

what's the problem?? how can I solved this??

TNX

Mehran
  • 73
  • 7
  • 1
    Either manually check for modifiers or you may have to look for a different library. I know your code isn't for windows, but as an example, I needed `ctypes` code to record the keyboard, and the first working example did what you're describing now, where `shift+a` would not fire off `a` by itself (and it was extremely complex). I continued looking for solutions though and found a one line version that worked perfectly, so I'd just suggest keep your eye open for something already built, since it's unlikely `HookManager` can do it without any extra help. – Peter Jul 03 '17 at 13:35
  • Ok. Thanks. As you said, I should find another library. – Mehran Jul 04 '17 at 04:05

0 Answers0