Exemplo n.º 1
0
    def __init__(self):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=15)
        self._fieldarea = None

        # title packet area
        title = bold_label("<big><u>Packet Area</u></big>")
        title.set_xalign(0.03)
        self.pack_start(title, False, False, 0)

        # Create packet area
        self.packet_view = self.generate_treeview()
        scrolled_packet = Gtk.ScrolledWindow(min_content_height=400,
                                             max_content_height=400,
                                             min_content_width=1050,
                                             max_content_width=1050)
        scrolled_packet.add(self.packet_view)

        # Create buttons to modify packet area
        btn_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        remove = Gtk.Button("Remove")
        remove.connect("clicked", self.remove)
        clear = Gtk.Button("Clear")
        clear.connect("clicked", self.clear)
        btn_box.pack_end(remove, False, False, 0)
        btn_box.pack_end(clear, False, False, 0)

        # Create main container
        box = create_box([scrolled_packet, btn_box])
        box.set_spacing(15)
        self.pack_start(box, False, False, 0)
Exemplo n.º 2
0
    def create_pdml_control_view(self):
        new_name_entry = Gtk.Entry(width_chars=35)

        save_as_new_button = Gtk.Button()
        save_as_new_button.add(create_small_label("Save as New\nPDML State"))

        save_current_button = Gtk.Button()
        save_current_button.add(create_small_label("Save Current\nPDML State"))

        close_current_button = Gtk.Button()
        close_current_button.add(
            create_small_label("Close Current\nPDML State"))

        delete_current_button = Gtk.Button()
        delete_current_button.add(
            create_small_label("Delete Current\nPDML State"))

        rename_entry = Gtk.Entry(width_chars=35)

        rename_button = Gtk.Button()
        rename_button.add(create_small_label("Delete Current\nPDML State"))

        box = create_box([
            Gtk.Label(" "),
            new_name_entry,
            save_as_new_button,
            save_current_button,  # REMOVE LATER
            close_current_button,
            delete_current_button,
            rename_entry,
            rename_button,
            Gtk.Label(" ")
        ])
        box.set_spacing(5)
        return box
Exemplo n.º 3
0
    def __init__(self, the_filter_expresion):
        Gtk.Window.__init__(self, title="Filter")
        self.set_default_size(400, 260)
        box = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL)

        filter_section = Gtk.Box(spacing=15)

        scrolledwindow = Gtk.ScrolledWindow(min_content_height=170,
                                            max_content_height=210,
                                            min_content_width=500,
                                            max_content_width=600)
        scrolledwindow.add(create_box([FilterTable()]))
        scrolledwindow.set_hadjustment(Gtk.Adjustment(value=1000, lower=1000))
        filter_section.pack_start(scrolledwindow, False, False, 0)

        buttons = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        copy = Gtk.Button("Copy")
        buttons.pack_end(copy, False, False, 0)
        update = Gtk.Button("Update")
        buttons.pack_end(update, False, False, 0)
        delete = Gtk.Button("Delete")
        buttons.pack_end(delete, False, False, 0)
        filter_section.pack_start(buttons, False, False, 0)
        box.pack_start(filter_section, False, False, 0)

        instructions = bold_label("\nCreate/Update a Filter\n")
        box.pack_start(instructions, False, False, 0)

        filter_name = Gtk.Entry(width_chars=15)
        box.pack_start(
            create_box([bold_label("\t\t\t  Filter Name "), filter_name]),
            False, False, 0)

        filter_expression = Gtk.Entry(width_chars=15)
        filter_expression.set_text(the_filter_expresion)
        box.pack_start(
            create_box(
                [bold_label("\t\tFilter Expression "), filter_expression]),
            False, False, 0)

        save = Gtk.Button("Save")
        cancel = Gtk.Button("Cancel")
        box.pack_end(create_box([cancel, save], False), False, False, 0)

        self.add(box)
Exemplo n.º 4
0
    def __init__(self):
        Gtk.Box.__init__(self,
                         spacing=10,
                         orientation=Gtk.Orientation.VERTICAL)
        self.set_homogeneous(False)
        self.pack_start(Gtk.Label(" "), False, False, 0)  # REMOVE LATER

        msg_types = Gtk.ListStore(str)
        msg_types.append(["\t\t\t\t     "])
        msg_types.append(["Request"])
        msg_types.append(["Reply"])
        sel_msg_type = Gtk.ComboBox.new_with_model(msg_types)
        renderer_text = Gtk.CellRendererText()
        sel_msg_type.pack_start(renderer_text, True)
        sel_msg_type.add_attribute(renderer_text, "text", 0)
        self.pack_start(
            create_box([bold_label("\tExisting Message Type  "),
                        sel_msg_type]), False, False, 0)

        cycle_button = Gtk.Button("Cycle Through Packets")
        self.pack_start(create_box([Gtk.Label("\t"), cycle_button], False),
                        False, False, 0)  #REMOVE LATER

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_hexpand(True)
        scrolledwindow.set_vexpand(True)

        scrolledwindow = Gtk.ScrolledWindow(min_content_height=200,
                                            max_content_height=200,
                                            min_content_width=230,
                                            max_content_width=230)
        text_view = Gtk.TextView(editable=False)
        self.buffer = text_view.get_buffer()
        self.buffer.insert_at_cursor(" ")
        scrolledwindow.add(text_view)
        box = create_box([
            bold_label("\tMessage Type Template \n"
                       "\tField Value Pair(s)"), scrolledwindow
        ])
        self.pack_start(box, False, False, 0)

        save = Gtk.Button("Save")
        clear = Gtk.Button("Clear")
        self.pack_end(create_box([save, clear], False), False, False, 0)
Exemplo n.º 5
0
    def __init__(self, the_iserver):
        Gtk.Grid.__init__(self, row_spacing=10)

        # Global variables
        self.tag_name = Gtk.Entry()
        self.tagged_field = Gtk.Entry(editable=False)
        self.iserver = the_iserver
        self.tag_cbox = None

        # Position of the 'Tag Area' title of panel
        area_label = self.displayLabel("Tag Area")
        self.add(area_label)

        # Position and layout of drop down menu of 'Saved Tag' field
        saved_tag_label = self.displayLabel("\t    Saved Tag")
        saved_tag_box = self.create_tag_cbox()
        self.attach_next_to(saved_tag_label, area_label,
                            Gtk.PositionType.BOTTOM, 1, 2)
        self.attach_next_to(saved_tag_box, saved_tag_label,
                            Gtk.PositionType.RIGHT, 1, 2)

        # Position and layout of 'Tag Name' field
        tag_name_label = self.displayLabel("\t    Tag Name")
        self.attach_next_to(tag_name_label, saved_tag_label,
                            Gtk.PositionType.BOTTOM, 1, 2)
        self.attach_next_to(self.displayEntry(self.tag_name), tag_name_label,
                            Gtk.PositionType.RIGHT, 1, 2)

        # Postion and layout of 'Tagged Field' field
        tagged_field_label = self.displayLabel("      Tagged Field")
        self.attach_next_to(tagged_field_label, tag_name_label,
                            Gtk.PositionType.BOTTOM, 1, 2)
        self.attach_next_to(self.displayEntry(self.tagged_field),
                            tagged_field_label, Gtk.PositionType.RIGHT, 1, 2)

        # Position and layout of 'Tag Description' field
        tag_des_label = self.displayLabel(" Tag Description")
        scrolledwindow = Gtk.ScrolledWindow(min_content_height=150,
                                            max_content_height=150,
                                            min_content_width=220,
                                            max_content_width=220)
        text_view = Gtk.TextView(buffer=Gtk.TextBuffer())
        self.description = text_view.get_buffer()
        scrolledwindow.add(text_view)
        self.attach_next_to(tag_des_label, tagged_field_label,
                            Gtk.PositionType.BOTTOM, 1, 2)
        self.attach_next_to(scrolledwindow, tag_des_label,
                            Gtk.PositionType.RIGHT, 1, 2)

        # Position and layout of 'Update' and 'Cancel' buttons
        update_bttn = Gtk.Button(label="Update")
        update_bttn.connect("clicked", self.on_clicked_update_button)
        cancel_bttn = Gtk.Button(label="Cancel")
        buttons = create_box([update_bttn, cancel_bttn], False)
        self.attach_next_to(buttons, tag_des_label, Gtk.PositionType.BOTTOM, 2,
                            1)
Exemplo n.º 6
0
    def __init__(self):
        Gtk.Box.__init__(self,
                         spacing=15,
                         orientation=Gtk.Orientation.VERTICAL)
        self.set_homogeneous(False)
        self.pack_start(Gtk.Label(" "), False, False, 0)  # REMOVE LATER

        msg_types = Gtk.ListStore(str)
        msg_types.append(["\t\t\t\t "])
        msg_types.append(["Request"])
        msg_types.append(["Reply"])
        sel_msg_type = Gtk.ComboBox.new_with_model(msg_types)
        renderer_text = Gtk.CellRendererText()
        sel_msg_type.pack_start(renderer_text, True)
        sel_msg_type.add_attribute(renderer_text, "text", 0)
        self.pack_start(
            create_box([bold_label("\tExisting Message Type "), sel_msg_type]),
            False, False, 0)

        sel_output_format = Gtk.ListStore(str)
        sel_output_format.append(["\t\t\t\t "])
        sel_output_format.append(["Scapy"])
        sel_output_format = Gtk.ComboBox.new_with_model(sel_output_format)
        renderer_text = Gtk.CellRendererText()
        sel_output_format.pack_start(renderer_text, True)
        sel_output_format.add_attribute(renderer_text, "text", 0)
        outformat_title = bold_label("\t\tMessage Template \n"
                                     "\t\tOutput Format")

        self.pack_start(create_box([outformat_title, sel_output_format]),
                        False, False, 0)

        sel_msg_template = Gtk.Entry()
        template_title = bold_label("\t\tMessage Template \n\t\tName")
        self.pack_start(create_box([template_title, sel_msg_template]), False,
                        False, 0)

        generate = Gtk.Button("Generate")
        clear = Gtk.Button("Clear")
        self.pack_end(create_box([generate, clear], False), False, False, 0)
Exemplo n.º 7
0
    def __init__(self, the_packet_area, the_iserver):
        Gtk.Box.__init__(self,
                         orientation=Gtk.Orientation.VERTICAL,
                         spacing=10)

        # Global variables
        self.iserver = the_iserver
        self.pdmlstate = None
        self.packet_area = the_packet_area
        self.expr_entry = None
        self.filter_cbox = None

        # Creates the title of the Filter Area
        title = Gtk.Label()
        title.set_markup("<b><big><u>Filter Area</u></big></b>")
        title.set_xalign(0.03)
        self.pack_start(title, False, False, 0)

        # Create entry for filter expression input
        self.expr_entry = Gtk.Entry(width_chars=42)

        # Create buttons of the Filter Area
        apply_btn = Gtk.Button(label="Apply")
        apply_btn.connect("clicked", self.on_apply_click)

        clear_btn = Gtk.Button(label="Clear")
        clear_btn.connect("clicked", self.on_clear_click)

        save_btn = Gtk.Button(label="Save")
        save_btn.connect("clicked", self.on_save_click)

        apply_saved_btn = Gtk.Button(label="Apply")
        apply_saved_btn.connect("clicked", self.on_apply_click)

        # Create combo box for saved filters
        saved_filters = Gtk.ListStore(str)
        saved_filters.append(["\t\t\t\t "])
        self.filter_cbox = Gtk.ComboBox.new_with_model(saved_filters)
        renderer_text = Gtk.CellRendererText()
        self.filter_cbox.pack_start(renderer_text, True)
        self.filter_cbox.add_attribute(renderer_text, "text", 0)

        box = create_box([
            Gtk.Label("   "), self.expr_entry,
            bold_label("Filter"), apply_btn, clear_btn, save_btn,
            bold_label("Saved Filter"), self.filter_cbox, apply_saved_btn
        ])
        box.set_spacing(15)
        self.pack_start(box, False, False, 0)