コード例 #1
0
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _('Layout'))

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #2
0
ファイル: ControlWidget.py プロジェクト: trevordavenport/nmap
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _("Layout"))

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #3
0
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _('Interpolation'))

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #4
0
ファイル: ControlWidget.py プロジェクト: trevordavenport/nmap
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _("Interpolation"))

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #5
0
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _('View'))
        self.set_expanded(True)

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #6
0
ファイル: ControlWidget.py プロジェクト: trevordavenport/nmap
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, _("View"))
        self.set_expanded(True)

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #7
0
    def __init__(self, radialnet):
        """
        """
        BWExpander.__init__(self, 'Action')
        self.set_expanded(True)

        self.radialnet = radialnet

        self.__create_widgets()
コード例 #8
0
ファイル: NodeNotebook.py プロジェクト: zheli-1/nmap_crete
    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_('General information'))
        self.__sequences_frame = BWExpander(_('Sequences'))
        self.__os_frame = BWExpander(_('Operating System'))

        self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.')))
        self.__os_frame.bw_add(gtk.Label(_('No OS information.')))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_('Address:'))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info('addresses'):

            params = address['type'], address['addr']
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address['vendor'] is not None and address['vendor'] != '':
                address_text += " (%s)" % address['vendor']

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label,
                                      yoptions=gtk.FILL,
                                      xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info('hostnames') is not None:

            self.__hostname_label = BWSectionLabel(_('Hostname:'))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info('hostnames'):

                params = hostname['type'], hostname['name']
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list,
                                          yoptions=gtk.FILL)

        if self.__node.get_info('uptime') is not None:

            self.__uptime_label = BWSectionLabel(_('Last boot:'))

            seconds = self.__node.get_info('uptime')['seconds']
            lastboot = self.__node.get_info('uptime')['lastboot']

            text = _('%s (%s seconds).') % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value,
                                          yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info('sequences')
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(
                self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info('os')

        if os is not None:

            if 'matches' in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_INT,
                                                   gobject.TYPE_BOOLEAN)

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os['matches']:

                    self.__match_store.append([
                        os_match['accuracy'],
                        os_match['name'],
                        #os_match['db_line'],
                        0,  # unsupported
                        True
                    ])

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_('Match')))

            if 'classes' in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_BOOLEAN)

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os['classes']:

                    os_gen = os_class.get('os_gen', '')

                    self.__class_store.append([
                        os_class['accuracy'], os_class['vendor'],
                        os_class['type'], os_class['os_family'], os_gen, True
                    ])

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_('Class')))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os['fingerprint'])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_('Used ports:'))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if 'used_ports' in os:

                used_ports = os['used_ports']

                for port in used_ports:

                    params = port['id'], port['protocol'], port['state']
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_('Fingerprint')))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)
コード例 #9
0
ファイル: NodeNotebook.py プロジェクト: zheli-1/nmap_crete
class SystemPage(BWScrolledWindow):
    """
    """
    def __init__(self, node):
        """
        """
        BWScrolledWindow.__init__(self)

        self.__node = node
        self.__font = pango.FontDescription('Monospace')

        self.__create_widgets()

    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_('General information'))
        self.__sequences_frame = BWExpander(_('Sequences'))
        self.__os_frame = BWExpander(_('Operating System'))

        self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.')))
        self.__os_frame.bw_add(gtk.Label(_('No OS information.')))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_('Address:'))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info('addresses'):

            params = address['type'], address['addr']
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address['vendor'] is not None and address['vendor'] != '':
                address_text += " (%s)" % address['vendor']

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label,
                                      yoptions=gtk.FILL,
                                      xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info('hostnames') is not None:

            self.__hostname_label = BWSectionLabel(_('Hostname:'))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info('hostnames'):

                params = hostname['type'], hostname['name']
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list,
                                          yoptions=gtk.FILL)

        if self.__node.get_info('uptime') is not None:

            self.__uptime_label = BWSectionLabel(_('Last boot:'))

            seconds = self.__node.get_info('uptime')['seconds']
            lastboot = self.__node.get_info('uptime')['lastboot']

            text = _('%s (%s seconds).') % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value,
                                          yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info('sequences')
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(
                self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info('os')

        if os is not None:

            if 'matches' in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_INT,
                                                   gobject.TYPE_BOOLEAN)

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os['matches']:

                    self.__match_store.append([
                        os_match['accuracy'],
                        os_match['name'],
                        #os_match['db_line'],
                        0,  # unsupported
                        True
                    ])

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_('Match')))

            if 'classes' in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_BOOLEAN)

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os['classes']:

                    os_gen = os_class.get('os_gen', '')

                    self.__class_store.append([
                        os_class['accuracy'], os_class['vendor'],
                        os_class['type'], os_class['os_family'], os_gen, True
                    ])

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_('Class')))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os['fingerprint'])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_('Used ports:'))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if 'used_ports' in os:

                used_ports = os['used_ports']

                for port in used_ports:

                    params = port['id'], port['protocol'], port['state']
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_('Fingerprint')))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)

    def __create_sequences_widget(self, sequences):
        """Return a widget representing various OS detection sequences. The
        sequences argument is a dict with zero or more of the keys 'tcp',
        'ip_id', and 'tcp_ts'."""
        # sequences information widgets
        table = BWTable(5, 3)

        table.attach(BWSectionLabel(_('Class')), 1, 2, 0, 1)
        table.attach(BWSectionLabel(_('Values')), 2, 3, 0, 1)

        table.attach(BWSectionLabel(_('TCP *')), 0, 1, 1, 2)
        table.attach(BWSectionLabel(_('IP ID')), 0, 1, 2, 3)
        table.attach(BWSectionLabel(_('TCP Timestamp')), 0, 1, 3, 4)

        tcp = sequences.get('tcp')
        if tcp is not None:
            tcp_class = BWLabel(tcp['class'])
            tcp_class.set_selectable(True)

            table.attach(tcp_class, 1, 2, 1, 2)

            tcp_values = gtk.combo_box_entry_new_text()

            for value in tcp['values']:
                tcp_values.append_text(value)

            tcp_values.set_active(0)

            table.attach(tcp_values, 2, 3, 1, 2)

            tcp_note = BWLabel()
            tcp_note.set_selectable(True)
            tcp_note.set_line_wrap(False)
            tcp_note.set_alignment(1.0, 0.5)
            tcp_note.set_markup(TCP_SEQ_NOTE %
                                (tcp['index'], tcp['difficulty']))

            table.attach(tcp_note, 0, 3, 4, 5)

        ip_id = sequences.get('ip_id')
        if ip_id is not None:
            ip_id_class = BWLabel(ip_id['class'])
            ip_id_class.set_selectable(True)

            table.attach(ip_id_class, 1, 2, 2, 3)

            ip_id_values = gtk.combo_box_entry_new_text()

            for value in ip_id['values']:
                ip_id_values.append_text(value)

            ip_id_values.set_active(0)

            table.attach(ip_id_values, 2, 3, 2, 3)

        tcp_ts = sequences.get('tcp_ts')
        if tcp_ts is not None:
            tcp_ts_class = BWLabel(tcp_ts['class'])
            tcp_ts_class.set_selectable(True)

            table.attach(tcp_ts_class, 1, 2, 3, 4)

            if tcp_ts['values'] is not None:

                tcp_ts_values = gtk.combo_box_entry_new_text()

                for value in tcp_ts['values']:
                    tcp_ts_values.append_text(value)

                tcp_ts_values.set_active(0)

                table.attach(tcp_ts_values, 2, 3, 3, 4)

        return table
コード例 #10
0
ファイル: NodeNotebook.py プロジェクト: mogigoma/nmap
    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_('General information'))
        self.__sequences_frame = BWExpander(_('Sequences'))
        self.__os_frame = BWExpander(_('Operating System'))

        self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.')))
        self.__os_frame.bw_add(gtk.Label(_('No OS information.')))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_('Address:'))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info('addresses'):

            params = address['type'], address['addr']
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address['vendor'] is not None and address['vendor'] != '':
                address_text += " (%s)" % address['vendor']

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label,
                                      yoptions=gtk.FILL,
                                      xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info('hostnames') is not None:

            self.__hostname_label = BWSectionLabel(_('Hostname:'))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info('hostnames'):

                params = hostname['type'], hostname['name']
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list,
                                          yoptions=gtk.FILL)

        if self.__node.get_info('uptime') is not None:

            self.__uptime_label = BWSectionLabel(_('Last boot:'))

            seconds = self.__node.get_info('uptime')['seconds']
            lastboot = self.__node.get_info('uptime')['lastboot']

            text = _('%s (%s seconds).') % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value,
                                          yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info('sequences')
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(
                    self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info('os')

        if os is not None:

            if 'matches' in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_INT,
                                                   gobject.TYPE_BOOLEAN)

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os['matches']:

                    self.__match_store.append([os_match['accuracy'],
                                               os_match['name'],
                                               #os_match['db_line'],
                                               0,   # unsupported
                                               True])

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_('Match')))

            if 'classes' in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_BOOLEAN)

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os['classes']:

                    os_gen = os_class.get('os_gen', '')

                    self.__class_store.append([os_class['accuracy'],
                                               os_class['vendor'],
                                               os_class['type'],
                                               os_class['os_family'],
                                               os_gen,
                                               True])

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_('Class')))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os['fingerprint'])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_('Used ports:'))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if 'used_ports' in os:

                used_ports = os['used_ports']

                for port in used_ports:

                    params = port['id'], port['protocol'], port['state']
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_('Fingerprint')))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)
コード例 #11
0
ファイル: NodeNotebook.py プロジェクト: mogigoma/nmap
class SystemPage(BWScrolledWindow):
    """
    """
    def __init__(self, node):
        """
        """
        BWScrolledWindow.__init__(self)

        self.__node = node
        self.__font = pango.FontDescription('Monospace')

        self.__create_widgets()

    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_('General information'))
        self.__sequences_frame = BWExpander(_('Sequences'))
        self.__os_frame = BWExpander(_('Operating System'))

        self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.')))
        self.__os_frame.bw_add(gtk.Label(_('No OS information.')))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_('Address:'))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info('addresses'):

            params = address['type'], address['addr']
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address['vendor'] is not None and address['vendor'] != '':
                address_text += " (%s)" % address['vendor']

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label,
                                      yoptions=gtk.FILL,
                                      xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info('hostnames') is not None:

            self.__hostname_label = BWSectionLabel(_('Hostname:'))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info('hostnames'):

                params = hostname['type'], hostname['name']
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list,
                                          yoptions=gtk.FILL)

        if self.__node.get_info('uptime') is not None:

            self.__uptime_label = BWSectionLabel(_('Last boot:'))

            seconds = self.__node.get_info('uptime')['seconds']
            lastboot = self.__node.get_info('uptime')['lastboot']

            text = _('%s (%s seconds).') % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label,
                                          yoptions=gtk.FILL,
                                          xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value,
                                          yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info('sequences')
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(
                    self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info('os')

        if os is not None:

            if 'matches' in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_INT,
                                                   gobject.TYPE_BOOLEAN)

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os['matches']:

                    self.__match_store.append([os_match['accuracy'],
                                               os_match['name'],
                                               #os_match['db_line'],
                                               0,   # unsupported
                                               True])

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_('Match')))

            if 'classes' in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_STRING,
                                                   gobject.TYPE_BOOLEAN)

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os['classes']:

                    os_gen = os_class.get('os_gen', '')

                    self.__class_store.append([os_class['accuracy'],
                                               os_class['vendor'],
                                               os_class['type'],
                                               os_class['os_family'],
                                               os_gen,
                                               True])

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i],
                                                self.__cell,
                                                text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell,
                                                          text=i,
                                                          editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_('Class')))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os['fingerprint'])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_('Used ports:'))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if 'used_ports' in os:

                used_ports = os['used_ports']

                for port in used_ports:

                    params = port['id'], port['protocol'], port['state']
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_('Fingerprint')))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)

    def __create_sequences_widget(self, sequences):
        """Return a widget representing various OS detection sequences. The
        sequences argument is a dict with zero or more of the keys 'tcp',
        'ip_id', and 'tcp_ts'."""
        # sequences information widgets
        table = BWTable(5, 3)

        table.attach(BWSectionLabel(_('Class')), 1, 2, 0, 1)
        table.attach(BWSectionLabel(_('Values')), 2, 3, 0, 1)

        table.attach(BWSectionLabel(_('TCP *')), 0, 1, 1, 2)
        table.attach(BWSectionLabel(_('IP ID')), 0, 1, 2, 3)
        table.attach(BWSectionLabel(_('TCP Timestamp')), 0, 1, 3, 4)

        tcp = sequences.get('tcp')
        if tcp is not None:
            tcp_class = BWLabel(tcp['class'])
            tcp_class.set_selectable(True)

            table.attach(tcp_class, 1, 2, 1, 2)

            tcp_values = gtk.combo_box_entry_new_text()

            for value in tcp['values']:
                tcp_values.append_text(value)

            tcp_values.set_active(0)

            table.attach(tcp_values, 2, 3, 1, 2)

            tcp_note = BWLabel()
            tcp_note.set_selectable(True)
            tcp_note.set_line_wrap(False)
            tcp_note.set_alignment(1.0, 0.5)
            tcp_note.set_markup(
                    TCP_SEQ_NOTE % (tcp['index'], tcp['difficulty']))

            table.attach(tcp_note, 0, 3, 4, 5)

        ip_id = sequences.get('ip_id')
        if ip_id is not None:
            ip_id_class = BWLabel(ip_id['class'])
            ip_id_class.set_selectable(True)

            table.attach(ip_id_class, 1, 2, 2, 3)

            ip_id_values = gtk.combo_box_entry_new_text()

            for value in ip_id['values']:
                ip_id_values.append_text(value)

            ip_id_values.set_active(0)

            table.attach(ip_id_values, 2, 3, 2, 3)

        tcp_ts = sequences.get('tcp_ts')
        if tcp_ts is not None:
            tcp_ts_class = BWLabel(tcp_ts['class'])
            tcp_ts_class.set_selectable(True)

            table.attach(tcp_ts_class, 1, 2, 3, 4)

            if tcp_ts['values'] is not None:

                tcp_ts_values = gtk.combo_box_entry_new_text()

                for value in tcp_ts['values']:
                    tcp_ts_values.append_text(value)

                tcp_ts_values.set_active(0)

                table.attach(tcp_ts_values, 2, 3, 3, 4)

        return table
コード例 #12
0
ファイル: NodeNotebook.py プロジェクト: VonNaturAustreVe/nmap
    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_("General information"))
        self.__sequences_frame = BWExpander(_("Sequences"))
        self.__os_frame = BWExpander(_("Operating System"))

        self.__sequences_frame.bw_add(gtk.Label(_("No sequence information.")))
        self.__os_frame.bw_add(gtk.Label(_("No OS information.")))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_("Address:"))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info("addresses"):

            params = address["type"], address["addr"]
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address["vendor"] is not None and address["vendor"] != "":
                address_text += " (%s)" % address["vendor"]

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info("hostnames") is not None:

            self.__hostname_label = BWSectionLabel(_("Hostname:"))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info("hostnames"):

                params = hostname["type"], hostname["name"]
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list, yoptions=gtk.FILL)

        if self.__node.get_info("uptime") is not None:

            self.__uptime_label = BWSectionLabel(_("Last boot:"))

            seconds = self.__node.get_info("uptime")["seconds"]
            lastboot = self.__node.get_info("uptime")["lastboot"]

            text = _("%s (%s seconds).") % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value, yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info("sequences")
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info("os")

        if os is not None:

            if "matches" in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(
                    gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_INT, gobject.TYPE_BOOLEAN
                )

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os["matches"]:

                    self.__match_store.append(
                        [
                            os_match["accuracy"],
                            os_match["name"],
                            # os_match['db_line'],
                            0,  # unsupported
                            True,
                        ]
                    )

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i], self.__cell, text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell, text=i, editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_("Match")))

            if "classes" in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_BOOLEAN,
                )

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os["classes"]:

                    os_gen = os_class.get("os_gen", "")

                    self.__class_store.append(
                        [
                            os_class["accuracy"],
                            os_class["vendor"],
                            os_class["type"],
                            os_class["os_family"],
                            os_gen,
                            True,
                        ]
                    )

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i], self.__cell, text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell, text=i, editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_("Class")))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os["fingerprint"])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_("Used ports:"))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if "used_ports" in os:

                used_ports = os["used_ports"]

                for port in used_ports:

                    params = port["id"], port["protocol"], port["state"]
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_("Fingerprint")))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)
コード例 #13
0
ファイル: NodeNotebook.py プロジェクト: VonNaturAustreVe/nmap
class SystemPage(BWScrolledWindow):
    """
    """

    def __init__(self, node):
        """
        """
        BWScrolledWindow.__init__(self)

        self.__node = node
        self.__font = pango.FontDescription("Monospace")

        self.__create_widgets()

    def __create_widgets(self):
        """
        """
        self.__vbox = BWVBox()
        self.__vbox.set_border_width(6)

        self.__cell = gtk.CellRendererText()

        self.__general_frame = BWExpander(_("General information"))
        self.__sequences_frame = BWExpander(_("Sequences"))
        self.__os_frame = BWExpander(_("Operating System"))

        self.__sequences_frame.bw_add(gtk.Label(_("No sequence information.")))
        self.__os_frame.bw_add(gtk.Label(_("No OS information.")))

        # general information widgets
        self.__general = BWTable(3, 2)

        self.__address_label = BWSectionLabel(_("Address:"))
        self.__address_list = gtk.combo_box_entry_new_text()
        self.__address_list.child.set_editable(False)

        for address in self.__node.get_info("addresses"):

            params = address["type"], address["addr"]
            address_text = SYSTEM_ADDRESS_TEXT % params

            if address["vendor"] is not None and address["vendor"] != "":
                address_text += " (%s)" % address["vendor"]

            self.__address_list.append_text(address_text)

        self.__address_list.set_active(0)

        self.__general.bw_attach_next(self.__address_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
        self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)

        if self.__node.get_info("hostnames") is not None:

            self.__hostname_label = BWSectionLabel(_("Hostname:"))
            self.__hostname_list = gtk.combo_box_entry_new_text()
            self.__hostname_list.child.set_editable(False)

            for hostname in self.__node.get_info("hostnames"):

                params = hostname["type"], hostname["name"]
                self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)

            self.__hostname_list.set_active(0)

            self.__general.bw_attach_next(self.__hostname_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__hostname_list, yoptions=gtk.FILL)

        if self.__node.get_info("uptime") is not None:

            self.__uptime_label = BWSectionLabel(_("Last boot:"))

            seconds = self.__node.get_info("uptime")["seconds"]
            lastboot = self.__node.get_info("uptime")["lastboot"]

            text = _("%s (%s seconds).") % (lastboot, seconds)

            self.__uptime_value = BWLabel(text)
            self.__uptime_value.set_selectable(True)
            self.__uptime_value.set_line_wrap(False)

            self.__general.bw_attach_next(self.__uptime_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
            self.__general.bw_attach_next(self.__uptime_value, yoptions=gtk.FILL)

        self.__general_frame.bw_add(self.__general)
        self.__general_frame.set_expanded(True)

        sequences = self.__node.get_info("sequences")
        if len(sequences) > 0:
            self.__sequences_frame.bw_add(self.__create_sequences_widget(sequences))

        # operating system information widgets
        self.__os = gtk.Notebook()

        os = self.__node.get_info("os")

        if os is not None:

            if "matches" in os:

                self.__match_scroll = BWScrolledWindow()

                self.__match_store = gtk.ListStore(
                    gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_INT, gobject.TYPE_BOOLEAN
                )

                self.__match_treeview = gtk.TreeView(self.__match_store)

                for os_match in os["matches"]:

                    self.__match_store.append(
                        [
                            os_match["accuracy"],
                            os_match["name"],
                            # os_match['db_line'],
                            0,  # unsupported
                            True,
                        ]
                    )

                self.__match_column = list()

                for i in range(len(OSMATCH_HEADER)):

                    column = gtk.TreeViewColumn(OSMATCH_HEADER[i], self.__cell, text=i)

                    self.__match_column.append(column)

                    self.__match_column[i].set_reorderable(True)
                    self.__match_column[i].set_resizable(True)
                    self.__match_column[i].set_attributes(self.__cell, text=i, editable=3)

                    self.__match_column[i].set_sort_column_id(i)
                    self.__match_treeview.append_column(self.__match_column[i])

                self.__match_scroll.add_with_viewport(self.__match_treeview)

                self.__os.append_page(self.__match_scroll, BWLabel(_("Match")))

            if "classes" in os:

                self.__class_scroll = BWScrolledWindow()

                self.__class_store = gtk.ListStore(
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_STRING,
                    gobject.TYPE_BOOLEAN,
                )

                self.__class_treeview = gtk.TreeView(self.__class_store)

                for os_class in os["classes"]:

                    os_gen = os_class.get("os_gen", "")

                    self.__class_store.append(
                        [
                            os_class["accuracy"],
                            os_class["vendor"],
                            os_class["type"],
                            os_class["os_family"],
                            os_gen,
                            True,
                        ]
                    )

                self.__class_column = list()

                for i in range(len(OSCLASS_HEADER)):

                    column = gtk.TreeViewColumn(OSCLASS_HEADER[i], self.__cell, text=i)

                    self.__class_column.append(column)

                    self.__class_column[i].set_reorderable(True)
                    self.__class_column[i].set_resizable(True)
                    self.__class_column[i].set_attributes(self.__cell, text=i, editable=5)

                    self.__class_column[i].set_sort_column_id(i)
                    self.__class_treeview.append_column(self.__class_column[i])

                self.__class_scroll.add_with_viewport(self.__class_treeview)

                self.__os.append_page(self.__class_scroll, BWLabel(_("Class")))

            self.__fp_viewer = BWTextEditor()
            self.__fp_viewer.bw_modify_font(self.__font)
            self.__fp_viewer.bw_set_editable(False)
            self.__fp_viewer.bw_set_text(os["fingerprint"])

            self.__fp_ports = BWHBox()
            self.__fp_label = BWSectionLabel(_("Used ports:"))

            self.__fp_ports_list = gtk.combo_box_entry_new_text()
            self.__fp_ports_list.child.set_editable(False)

            self.__fp_vbox = BWVBox()

            if "used_ports" in os:

                used_ports = os["used_ports"]

                for port in used_ports:

                    params = port["id"], port["protocol"], port["state"]
                    self.__fp_ports_list.append_text(USED_PORTS_TEXT % params)

                self.__fp_ports_list.set_active(0)

                self.__fp_ports.bw_pack_start_noexpand_nofill(self.__fp_label)
                self.__fp_ports.bw_pack_start_expand_fill(self.__fp_ports_list)

                self.__fp_vbox.bw_pack_start_noexpand_nofill(self.__fp_ports)

            self.__os.append_page(self.__fp_viewer, BWLabel(_("Fingerprint")))
            self.__fp_vbox.bw_pack_start_expand_fill(self.__os)

            self.__os_frame.bw_add(self.__fp_vbox)
            self.__os_frame.set_expanded(True)

        self.__vbox.bw_pack_start_noexpand_nofill(self.__general_frame)
        self.__vbox.bw_pack_start_expand_fill(self.__os_frame)
        self.__vbox.bw_pack_start_noexpand_nofill(self.__sequences_frame)

        self.add_with_viewport(self.__vbox)

    def __create_sequences_widget(self, sequences):
        """Return a widget representing various OS detection sequences. The
        sequences argument is a dict with zero or more of the keys 'tcp',
        'ip_id', and 'tcp_ts'."""
        # sequences information widgets
        table = BWTable(5, 3)

        table.attach(BWSectionLabel(_("Class")), 1, 2, 0, 1)
        table.attach(BWSectionLabel(_("Values")), 2, 3, 0, 1)

        table.attach(BWSectionLabel(_("TCP *")), 0, 1, 1, 2)
        table.attach(BWSectionLabel(_("IP ID")), 0, 1, 2, 3)
        table.attach(BWSectionLabel(_("TCP Timestamp")), 0, 1, 3, 4)

        tcp = sequences.get("tcp")
        if tcp is not None:
            tcp_class = BWLabel(tcp["class"])
            tcp_class.set_selectable(True)

            table.attach(tcp_class, 1, 2, 1, 2)

            tcp_values = gtk.combo_box_entry_new_text()

            for value in tcp["values"]:
                tcp_values.append_text(value)

            tcp_values.set_active(0)

            table.attach(tcp_values, 2, 3, 1, 2)

            tcp_note = BWLabel()
            tcp_note.set_selectable(True)
            tcp_note.set_line_wrap(False)
            tcp_note.set_alignment(1.0, 0.5)
            tcp_note.set_markup(TCP_SEQ_NOTE % (tcp["index"], tcp["difficulty"]))

            table.attach(tcp_note, 0, 3, 4, 5)

        ip_id = sequences.get("ip_id")
        if ip_id is not None:
            ip_id_class = BWLabel(ip_id["class"])
            ip_id_class.set_selectable(True)

            table.attach(ip_id_class, 1, 2, 2, 3)

            ip_id_values = gtk.combo_box_entry_new_text()

            for value in ip_id["values"]:
                ip_id_values.append_text(value)

            ip_id_values.set_active(0)

            table.attach(ip_id_values, 2, 3, 2, 3)

        tcp_ts = sequences.get("tcp_ts")
        if tcp_ts is not None:
            tcp_ts_class = BWLabel(tcp_ts["class"])
            tcp_ts_class.set_selectable(True)

            table.attach(tcp_ts_class, 1, 2, 3, 4)

            if tcp_ts["values"] is not None:

                tcp_ts_values = gtk.combo_box_entry_new_text()

                for value in tcp_ts["values"]:
                    tcp_ts_values.append_text(value)

                tcp_ts_values.set_active(0)

                table.attach(tcp_ts_values, 2, 3, 3, 4)

        return table