Python GUI Network Security Detector - ARP, ICMP, TCP Attack Detection & Network Scanner
class MainWindow:
def __init__(self):
self.root = tk.Tk()
self.root.title('ARP Detector')
self.root.geometry('400x350')
self.arp_button = tk.Button(self.root, text='ARP Detection', command=self.show_arp_page)
self.arp_button.pack()
self.icmp_button = tk.Button(self.root, text='ICMP Flood Detection', command=self.show_icmp_detector_page)
self.icmp_button.pack()
self.tcp_button = tk.Button(self.root, text='TCP Attack Detection', command=self.show_tcp_detector_page)
self.tcp_button.pack()
self.network_button = tk.Button(self.root, text='Network Scanner', command=self.network_scanner_page)
self.network_button.pack()
self.root.mainloop()
def show_arp_page(self):
self.arp_page = tk.Toplevel(self.root)
ArpDetectorPage(self.arp_page)
self.network_button = tk.Button(self.root, text='Network Scanner', command=self.toggle_network_scanner, state=tk.DISABLED)
self.network_button.pack()
self.timeout_label = tk.Label(self.root, text='Detection Time (s)')
self.timeout_label.pack()
self.timeout_entry = tk.Entry(self.root)
self.timeout_entry.pack()
self.set_timeout_button = tk.Button(self.root, text='Set Timeout', command=self.set_timeout)
self.set_timeout_button.pack()
self.root.mainloop()
def set_timeout(self):
timeout = int(self.timeout_entry.get())
messagebox.showinfo('提示', f'检测时间已设置为{timeout}秒')
def start_detection(self):
timeout = int(self.timeout_entry.get())
self.status_label.config(text='Running')
self.start_button.config(state=tk.DISABLED)
self.stop_button.config(state=tk.NORMAL)
self.arp_button.config(state=tk.NORMAL)
self.icmp_button.config(state=tk.NORMAL)
self.tcp_button.config(state=tk.NORMAL)
self.network_button.config(state=tk.NORMAL)
self.arp_detector = ArpDetectorPage('ens33',timeout)
self.arp_detector.start()
self.icmp_flood_detector = IcmpFloodDetectorPage('ens33',timeout)
self.icmp_flood_detector.start()
self.tcp_attack_detector = TcpAttackDetectorPage('ens33',timeout)
self.tcp_attack_detector.start()
self.network_scanner = NetworkScannerPage('ens33',timeout)
self.network_scanner.start()
This script showcases a graphical user interface for network security detection using Python and Tkinter. It features ARP detection, ICMP flood detection, TCP attack detection, and network scanning. Users can set a timeout duration for the detection processes. The GUI allows for easy navigation and monitoring of network activity for potential threats.
Note: This code is provided as an example and requires the necessary libraries (Tkinter, socket, etc.) to be installed before execution. The interface name ('ens33') used in the code needs to be adjusted based on your network interface. This is a basic example and may need further development and customization to meet specific security needs.
原文地址: https://www.cveoy.top/t/topic/jnWC 著作权归作者所有。请勿转载和采集!