代码拉取完成,页面将自动刷新
import ttkbootstrap as ttk
from m_theme.theme import get_theme,write_theme
from m_scan.scan_UI import Scan
from m_passive_detection.passive_detection_ui import PassiveDetectionUi
from m_sniff.sniffPcap_ui import sniff_GUI
from m_dhcp.dhcp_server import DhcpServerUi
from m_geoip.geo_ip_ui import GeoIPUI
from m_send_packet.send_pacet_UI import SendPacetUI
from m_file_extract.file_extract_ui import FileExtract_ui
from m_merge_pcap.merge_pcap_ui import Merge_ui
from m_change_time.change_time import ChangeTime_ui
from m_splitFlow.splitFlow_ui import Split_ui
from m_compare_pcap.compare_pcap_ui import Compare_ui
from m_editPackets.editPackets import EditPackets
from m_changePacket.changePacetUI import Change_Pacet_UI
from m_machProto_danger.machProto_danger_ui import MachProto_danger_ui
from m_debug.debug import record_debug_log
import random
import os
class main:
def __init__(self):
self.root = ttk.Window(
title='Pcaptool',
size=(540,650),
themename=get_theme()
)
self.debug_n = 0
self.root.call('tk', 'scaling', 1.333) # 设置程序缩放为1.333
# 创建侧边导航栏
self.sidebar = ttk.Frame(self.root)
self.sidebar.pack(side='left',padx=5,pady=10, fill='y')
# 创建主页面容器
self.main_Labelframe = ttk.Labelframe(self.root,bootstyle="secondary")
self.main_Labelframe.pack(padx=5,pady=5, fill='both')
self.main_frame = ttk.Frame(self.main_Labelframe)
self.main_frame.pack(padx=10,pady=10, fill='both')
# 添加导航按钮
ttk.Button(self.sidebar,bootstyle="light", text='扫描器', command=self.scan).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='被动探测', command=self.detection).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='网络嗅探', command=self.sniff).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='DHCP服务器', command=self.dhcp_server).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='地理位置查询', command=self.geoip).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light",text='文件还原', command=self.file_extract).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light",text='发送数据包', command=self.send_pcap).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='合并pcap文件', command=self.merge_pcap).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='修改时间戳', command=self.change_time).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='拆分pcap为多条流', command=self.split_pcap).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='对比两个pcap文件', command=self.compare_pcap).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='pcap字段编辑工具', command=self.edit_packet).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='修改pcap的六元组', command=self.change_six).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='生成标准协议和威胁报文', command=self.danger).pack(pady=3, fill='x')
ttk.Button(self.sidebar,bootstyle="light", text='切换主题', command=self.change_theme).pack(pady=3, fill='x')
# 初始化显示
self.scan()
self.root.mainloop()
def show_frame(self,frame_class,funcName,size):
path=os.path.dirname(os.path.realpath(__file__))#py真实路径
path2 =os.path.dirname(os.path.realpath(__name__))#exe真实路径
# 销毁容器内的所有子组件
for widget in self.main_frame.winfo_children():
widget.destroy()
# 创建新帧并添加到容器中
new_frame = frame_class(self.main_frame,path,path2)
self.main_Labelframe.config(text=funcName)
self.root.geometry(size)
new_frame.run()
def scan(self):
self.show_frame(Scan,"扫描器","540x650")
self.debug_n +=1
if self.debug_n == 10:
print("debug模式开启..")
record_debug_log()
def detection(self):
self.show_frame(PassiveDetectionUi,"被动探测","540x650")
def sniff(self):
path=os.path.dirname(os.path.realpath(__file__))#py真实路径
path2 =os.path.dirname(os.path.realpath(__name__))#exe真实路径
# 销毁容器内的所有子组件
for widget in self.main_frame.winfo_children():
widget.destroy()
# 创建新帧并添加到容器中
new_frame = sniff_GUI(self.root,self.main_frame,path,path2)
self.main_Labelframe.config(text="网络嗅探")
self.root.geometry("1100x720")
new_frame.run()
def dhcp_server(self):
self.show_frame(DhcpServerUi,"DHCP服务器","540x650")
def geoip(self):
self.show_frame(GeoIPUI,"地理位置查询","540x650")
def file_extract(self):
self.show_frame(FileExtract_ui,"文件还原","540x650")
def send_pcap(self):
self.show_frame(SendPacetUI,"发送数据包","540x650")
def merge_pcap(self):
self.show_frame(Merge_ui,"合并pcap文件","540x650")
def change_time(self):
self.show_frame( ChangeTime_ui,"修改时间戳","540x650")
def split_pcap(self):
self.show_frame( Split_ui,"拆分pcap为多条流","540x650")
def compare_pcap(self):
self.show_frame(Compare_ui,"对比两个pcap文件","540x650")
def edit_packet(self):
self.show_frame( EditPackets,"pcap字段编辑工具","1100x650")
def change_six(self):
self.show_frame(Change_Pacet_UI,"修改pcap的六元组","540x650")
def danger(self):
self.show_frame(MachProto_danger_ui,"生成标准协议和威胁报文","540x650")
def change_theme(self):
try:
themes = ['cosmo', 'flatly', 'litera', 'minty', 'lumen', 'sandstone', 'yeti', 'pulse', 'united', 'morph', 'journal', 'darkly', 'superhero', 'solar', 'cyborg', 'vapor', 'simplex', 'cerculean']
theme = random.choice(themes)
self.root.style.theme_use(theme)
if "pcaptool_theme" not in os.listdir(r"c:/"):
os.mkdir("c:/pcaptool_theme")
write_theme(theme)
except:
...
if __name__ == "__main__":
app = main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。