Python GUI界面版端口扫描工具

admin 2022年6月7日00:11:10评论96 views字数 2266阅读7分33秒阅读模式

转载于:行者匠心 

值得分享学习学习

一、结构导图
Python GUI界面版端口扫描工具
二、部分代码:
# 图形界面
class PortScan(object):
    def __init__(self):
        # 初始化一个窗口实例
        self.window = tk.Tk()  # 初始化一个窗口实例
        self.window.title('Port Scanner (公众号释然IT杂谈)')  # 窗口标题
        self.window.geometry("500x400")  # 窗口大小
        self.ip = 0 # 设置IP

        tk.Label(self.window,text='配置如下:').place(x=10,y=20,anchor='nw')

        # 定义两个单选框:单IP和IP段
        self.var = tk.StringVar()
        tk.Label(self.window,text='扫描方式:').place(x=10,y=50,anchor='nw')
        self.single_ip = tk.Radiobutton(self.window, text='单IP', variable=self.varvalue='S')
        self.multi_ip = tk.Radiobutton(self.window, text='IP段', variable=self.varvalue='M')

        # IP标签和输入框
        tk.Label(self.window,text='IP:').place(x=10,y=90,anchor='nw')
        self.ip = tk.Entry(self.window,show='')

        # port标签和输入框
        tk.Label(self.window,text='端口:').place(x=10,y=130,anchor='nw')
        self.port = tk.Entry(self.window,show='')

        # 超时标签和输入框
        tk.Label(self.window,text='超时:').place(x=10,y=170,anchor='nw')
        self.time = tk.Entry(self.window,show='',width=5)
        tk.Label(self.window,text='毫秒').place(x=110,y=170,anchor='nw')

        # 线程滚动条
        self.s = tk.Scale(self.window,label='线程',from_=3,to=21,orient=tk.HORIZONTAL,
                     length=200, showvalue=2, tickinterval=6, resolution=1,command=self.thread)
        # 输出文本框
        self.text1 = tk.Text(self.window,height=20,width=30)

        # 按钮:扫描、退出和清空
        tk.Button(self.window,text='扫描',width=5,command=self.scan).place(x=20,y=310,anchor='nw')
        tk.Button(self.window,text='退出',width=5,command=self.exit).place(x=90,y=310,anchor='nw')
        tk.Button(self.window,text='清空',width=5,command=self.delete).place(x=160,y=310,anchor='nw')

        tk.Label(self.window,text='扫描结果:').place(x=250,y=20,anchor='nw')

    # 组件布置/定位
    def gui_arrand(self):
        self.single_ip.place(x=80,y=50,anchor='nw')
        self.multi_ip.place(x=150,y=50,anchor='nw')
        self.ip.place(x=60,y=90,anchor='nw')
        self.port.place(x=60,y=130,anchor='nw')
        self.time.place(x=60,y=170,anchor='nw')
        self.s.place(x=10,y=210,anchor='nw')
        self.text1.place(x=255,y=50,anchor='nw',width='230')
三、运行结果:
Python GUI界面版端口扫描工具
四、工具获取:

完整代码获取及生成的exe文件后台回复 “ GUI ” 获取

Python GUI界面版端口扫描工具

Python GUI界面版端口扫描工具

Python GUI界面版端口扫描工具

Python GUI界面版端口扫描工具

原文始发于微信公众号(释然IT杂谈):Python GUI界面版端口扫描工具

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年6月7日00:11:10
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Python GUI界面版端口扫描工具http://cn-sec.com/archives/1090985.html

发表评论

匿名网友 填写信息