示例#1
0
class GUI:
    def __init__(self, root):
        self.root = root
        self.root.title('Packet Sniffer')
        self.root.geometry('{}x{}'.format(800, 600))
        self.sniffer = PacketSniffer()
        self.set_menu()
        # add quick select icons
        self.all_packets = self.set_multilistbox()
        # add packet sequence multilistbox
        # add packet info listbox
        # add program data bar

    def set_menu(self):
        menubar = Menu(self.root)
        filemenu = Menu(menubar, tearoff=0)
        filemenu.add_command(label="Bind to interface", command=self.hello)
        filemenu.add_command(label="Start", command=self.sniffer.start_sniff)
        filemenu.add_command(label="Stop", command=self.sniffer.stop_sniff)
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=self.root.quit)
        menubar.add_cascade(label="File", menu=filemenu)
        self.root.config(menu=menubar)

    def set_multilistbox(self):
        self.sniffer.set_root(self.root)

    def hello(self):
        print("hello")
示例#2
0
 def __init__(self, root):
     self.root = root
     self.root.title('Packet Sniffer')
     self.root.geometry('{}x{}'.format(800, 600))
     self.sniffer = PacketSniffer()
     self.set_menu()
     # add quick select icons
     self.all_packets = self.set_multilistbox()