Example #1
0
    def __init__(self):
        """
        """
        super(SaveDialog,
              self).__init__(title=_("Save Topology"),
                             action=gtk.FILE_CHOOSER_ACTION_SAVE,
                             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                      gtk.STOCK_SAVE, gtk.RESPONSE_OK))

        self.__combo = gtk.combo_box_new_text()

        types_list = TYPES.keys()
        types_list.sort()

        for i in types_list:
            self.__combo.append_text(i)

        self.__combo.set_active(1)
        self.__label = HIGLabel(_("Select the output type:"))

        self.__hbox = HIGHBox()
        self.__hbox._pack_noexpand_nofill(self.__label)
        self.__hbox._pack_expand_fill(self.__combo)

        self.set_extra_widget(self.__hbox)
        self.set_do_overwrite_confirmation(True)

        self.__hbox.show_all()
 def set_osclass(self, osclass=None):
     child = self.osclass_expander.get_child()
     if child is not None:
         self.osclass_expander.remove(child)
     
     if osclass is None:
         self.osclass_expander.set_sensitive(False)
         return
     else:
         self.osclass_expander.set_sensitive(True)
         self.osclass_expander.set_use_markup(True)
         table, hbox = self.create_table_hbox()
         
         table.attach(HIGEntryLabel(_('Type')),0,1,0,1)
         table.attach(HIGEntryLabel(_('Vendor')),1,2,0,1)
         table.attach(HIGEntryLabel(_('OS Family')),2,3,0,1)
         table.attach(HIGEntryLabel(_('OS Generation')),3,4,0,1)
         table.attach(HIGEntryLabel(_('Accuracy')),4,5,0,1)
         
         y1=1;y2=2
         
         for o in osclass:
             table.attach(HIGEntryLabel(o['type']),0,1,y1,y2)
             table.attach(HIGEntryLabel(o['vendor']),1,2,y1,y2)
             table.attach(HIGEntryLabel(o['osfamily']),2,3,y1,y2)
             table.attach(HIGEntryLabel(o.get('osgen', '')),3,4,y1,y2)
             
             progress = gtk.ProgressBar()
             progress.set_text(o['accuracy']+'%')
             progress.set_fraction(float(o['accuracy'])/100.0)
             table.attach(progress,4,5,y1,y2)
             y1+=1;y2+=1
         
         self.osclass_expander.add(hbox)
Example #3
0
    def __on_skip_updates(self, widget):
        "Called when the user click on the skip button"

        # We need to repopulate the tree
        self.richlist.clear()
        self.populate()

        self.p_window.toolbar.unset_status()

        if self.restart_btn.flags() & gtk.VISIBLE:
            # That callback is called from a self.___on_install_updates

            self.restart_btn.hide()
            self.p_window.animated_bar.label = \
                _('Rembember to restart UMIT to use new version of plugins.')

        else:
            self.p_window.animated_bar.label = \
                    _('Update skipped')

        self.p_window.animated_bar.start_animation(True)

        self.skip_install_btn.hide()
        self.install_updates_btn.hide()
        self.find_updates_btn.show()

        self.menu_enabled = True
Example #4
0
    def fingerprint_diff(self, up_old, up_new, ts_old, ts_new, tts_old,
        tts_new, iis_old, iis_new, diff=True):
        """
        Do fingerprint diff.
        """
        
        if not diff:
            status = "Added"
        elif (up_old != up_new) or (ts_old != ts_new) or (tts_old != tts_new) \
            or (iis_old != iis_new):
            status = "Modified"
        else:
            status = "Unchanged"

        r = self.diff_tree.append(None, [status[0], _("Fingerprint"), "", "",
            "", self.colors.get_hex_color(status[0])])
        # Uptime
        self.std_diff(up_old, up_new, _("Uptime"), diff, r)

        # TCP Sequence
        self.std_diff(ts_old, ts_new, _("TCP Sequence"), diff, r)

        # TCP TS Sequence
        self.std_diff(tts_old, tts_new, _("TCP TS Sequence"), diff, r)

        # IP ID Sequence
        self.std_diff(iis_old, iis_new, _("IP ID Sequence"), diff, r)
Example #5
0
    def set_scan_infos(self, scan_info):
        for scan in scan_info:
            exp = gtk.Expander('<b>%s - %s</b>' %
                               (_('Scan Info'), scan['type'].capitalize()))
            exp.set_use_markup(True)
            hbox = HIGHBox()
            table = HIGTable()
            table.set_border_width(5)
            table.set_row_spacings(6)
            table.set_col_spacings(6)

            table.attach(HIGEntryLabel(_('Scan type:')), 0, 1, 0, 1)
            table.attach(HIGEntryLabel(scan['type']), 1, 2, 0, 1)

            table.attach(HIGEntryLabel(_('Protocol:')), 0, 1, 1, 2)
            table.attach(HIGEntryLabel(scan['protocol']), 1, 2, 1, 2)

            table.attach(HIGEntryLabel(_('# scanned ports:')), 0, 1, 2, 3)
            table.attach(HIGEntryLabel(scan['numservices']), 1, 2, 2, 3)

            table.attach(HIGEntryLabel(_('Services:')), 0, 1, 3, 4)
            table.attach(self.get_service_view(scan['services'].split(',')),\
                                               1,2,3,4)

            hbox._pack_noexpand_nofill(hig_box_space_holder())
            hbox._pack_noexpand_nofill(table)

            exp.add(hbox)
            self._pack_noexpand_nofill(exp)
Example #6
0
    def extraports_diff(self, ep_o, ep_n, diff=True):
        """
        Do extraports diff.
        """
        if not diff:
            status = "Added"
            ep_o = ep_n
        elif ep_o != ep_n:
            status = "Modified"
        else:
            status = "Unchanged"

        r = self.diff_tree.append(None, [status[0], _("Extraports"), "", "",
            "", self.colors.get_hex_color(status[0])])

        for key, values in ep_o.items():
            if key in ep_n:
                new_value = ep_n[key]
            else:
                new_value = NA

            d_temp = {_('count'): values}
            dn_temp = {_('count'): new_value}
            self.std_diff(d_temp, dn_temp, key, diff, r)

        if not diff:
            # Job is complete here if diff=False
            return

        for key, values in ep_n.items():
            if key in ep_o:
                continue

            d_temp = {_('count'): values}
            self.std_diff(d_temp, d_temp, key, False, r)
 def set_scan_infos(self, scan_info):
     for scan in scan_info:
         exp = gtk.Expander('<b>%s - %s</b>' % (_('Scan Info'),
                                                scan['type'].capitalize()))
         exp.set_use_markup(True)
         hbox = HIGHBox()
         table = HIGTable()
         table.set_border_width(5)
         table.set_row_spacings(6)
         table.set_col_spacings(6)
         
         table.attach(HIGEntryLabel(_('Scan type:')),0,1,0,1)
         table.attach(HIGEntryLabel(scan['type']),1,2,0,1)
         
         table.attach(HIGEntryLabel(_('Protocol:')),0,1,1,2)
         table.attach(HIGEntryLabel(scan['protocol']),1,2,1,2)
         
         table.attach(HIGEntryLabel(_('# scanned ports:')),0,1,2,3)
         table.attach(HIGEntryLabel(scan['numservices']),1,2,2,3)
         
         table.attach(HIGEntryLabel(_('Services:')),0,1,3,4)
         table.attach(self.get_service_view(scan['services'].split(',')),\
                                            1,2,3,4)
         
         hbox._pack_noexpand_nofill(hig_box_space_holder())
         hbox._pack_noexpand_nofill(table)
         
         exp.add (hbox)
         self._pack_noexpand_nofill(exp)
    def create_and_attach_widgets(self):
        self.option_label = HIGSectionLabel('New Option')
        self.attach(self.option_label, 0, 3, 0, 1)

        self.name_label = HIGEntryLabel(_('Name:'))
        self.name_entry = HIGTextEntry()
        self.attach(self.name_label, 0, 1, 1, 2)
        self.attach(self.name_entry, 1, 3, 1, 2)

        self.hint_label = HIGEntryLabel(_('Hint:'))
        self.hint_entry = HIGTextEntry()
        self.attach(self.hint_label, 0, 1, 2, 3)
        self.attach(self.hint_entry, 1, 3, 2, 3)

        self.need_root = gtk.CheckButton(_('Need root'))
        self.attach(self.need_root, 0, 1, 3, 4)

        self.options_label = HIGEntryLabel(_('Options:'))
        hbox = HIGHBox()
        self.options_entry = HIGTextEntry()
        self.insert_arg_button = HIGButton(title='Args', stock='gtk-add')
        self.insert_arg_button.connect('clicked', self.update_args)
        self.attach(self.options_label, 0, 1, 4, 5)
        self.attach(self.options_entry, 1, 2, 4, 5)
        self.attach(self.insert_arg_button, 2, 3, 4, 5)

        self.aguments_label = HIGEntryLabel(_('Arguments:'))
        self.arguments_entry = HIGTextEntry()
        self.arguments_entry.set_editable(False)
        self.attach(self.aguments_label, 0, 1, 5, 6)
        self.attach(self.arguments_entry, 1, 3, 5, 6)
    def __create_widgets(self):
        self.vbox = HIGVBox()
        self.hbox = HIGHBox()
        self.img_logo = gtk.Image()
        self.event_img_logo = gtk.EventBox()
        self.img = 1

        self.d = {}
        for c in (65, 97):
            for i in range(26):
                self.d[chr(i + c)] = chr((i + 13) % 26 + c)

        self.lbl_program_version = gtk.Label("""\
<span size='30000' weight='heavy'>Umit %s</span>""" % VERSION)

        self.lbl_program_description = gtk.Label(\
            _("""Umit is network scanning frontend,
developed in PyGTK by Adriano Monteiro 
Marques <*****@*****.**>
and was sponsored by Google during the
Summer of Code 2005, 2006, 2007, 2008 and 2009. Thanks Google!"""))

        self.lbl_copyright = gtk.Label("<small>Copyright (C) 2005-2006 \
Insecure.Com LLC. and (C) 2007-2009 Adriano Monteiro Marques</small>")

        self.lbl_program_website = gtk.Label(\
            "<span underline='single' \
            foreground='blue'>http://www.umitproject.org</span>"                                                                )

        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
        self.btn_credits = HIGButton(_("Credits"))
    def _create_columns(self):
        """
        Create TreeView columns.
        """
        columns = (
            (_("Inventory"), 0), (_("Host address"), 0),
            (_("Category"), 0), (_("Short change description"), 400),
            (_("Change date"), 0)
            )

        self.tview.columns = [None]*self.tcolumns

        start = len(columns) - self.tcolumns

        # remove previous columns if any
        for column in self.tview.get_columns():
            self.tview.remove_column(column)

        for i in range(self.tcolumns):
            column = columns[i + start]

            self.tview.columns[i] = gtk.TreeViewColumn(column[0])

            if column[1]: # minimum size
                self.tview.columns[i].set_min_width(column[1])
Example #11
0
    def invcombo(self):
        """
        Creates and return a ToolItem with a combobox with a full listing
        of Inventories.
        """
        align = gtk.Alignment(0, 0.5, 0, 1)
        align.set_padding(0, 0, 6, 0)
        cbinv = gtk.combo_box_new_text()
        align.add(cbinv)

        cbinv.append_text(_("Search in"))
        cbinv.append_text(_("All Inventories"))
        cbinv.set_active(1)
        cbinv.connect('changed', self._change_inventory)
        self.inventory_list.append(_("Search in"))
        self.inventory_list.append(_("All Inventories"))

        self.inventory = cbinv.get_active_text()

        item = gtk.ToolItem()
        item.add(align)

        if not self.invdb:
            return item

        for invid, invname in self.invdb.get_inventories_ids_names():
            cbinv.append_text('%s' % invname)
            self.inventory_list.append(invname)

        return item
Example #12
0
    def invcombo(self):
        """
        Creates and return a ToolItem with a combobox with a full listing
        of Inventories.
        """
        align = gtk.Alignment(0, 0.5, 0, 1)
        align.set_padding(0, 0, 6, 0)
        cbinv = gtk.combo_box_new_text()
        align.add(cbinv)

        cbinv.append_text(_("Search in"))
        cbinv.append_text(_("All Inventories"))
        cbinv.set_active(1)
        cbinv.connect('changed', self._change_inventory)
        self.inventory_list.append(_("Search in"))
        self.inventory_list.append(_("All Inventories"))

        self.inventory = cbinv.get_active_text()

        item = gtk.ToolItem()
        item.add(align)

        if not self.invdb:
            return item

        for invid, invname in self.invdb.get_inventories_ids_names():
            cbinv.append_text('%s' % invname)
            self.inventory_list.append(invname)

        return item
Example #13
0
    def choose_forward(self, widget):
        if self.directions['Choose'].command_radio.get_active():
            if self.directions['Choose'].target_entry.get_text() == '':
                alert = HIGAlertDialog(message_format=_('No target selected!'),\
                                   secondary_text=_('You must provide a target \
to be scanned.'               ))
                alert.run()
                alert.destroy()

                self.directions['Choose'].target_entry.grab_focus()

                return None

        self.main_vbox.remove(self.directions['Choose'])
        self.directions['Choose'].hide()
        if self.directions['Choose'].profile_radio.get_active():
            self.main_vbox._pack_expand_fill(self.directions['Profile'])
            self.directions['Profile'].show_all()

            self.directions['LastPage'] = self.directions['Profile']
            self.directions['Profile'].prof = True
            self.target = '<target>'
        else:
            self.main_vbox._pack_expand_fill(self.directions['Command'])
            self.directions['Command'].show_all()

            self.directions['LastPage'] = self.directions['Choose']
            self.directions['Profile'].prof = False
            self.target = self.directions['Choose'].target_entry.get_text()
            self.directions['Choose'].add_new_target(self.target)

        self.update_command()
Example #14
0
    def searchcombo(self):
        """
        Create and return a ToolItem with an entry combobox.
        """
        cbentry = gtk.combo_box_entry_new_text()
        cbentry.append_text(_("Search term"))
        cbentry.set_active(0)
        cbentry.remove_text(0)  # remove "Search Term" from searchcombo
        cbentry.child.connect('key-press-event', self.comboentry_press)
        cbentry.show()

        btn_search = gtk.Button(stock=gtk.STOCK_FIND)
        btn_search.connect('clicked', self.perform_search, cbentry.child)
        btn_search.show()
        lbl = btn_search.get_children()[0].get_children()[0].get_children()[1]
        lbl.set_label("")
        self.tooltips.set_tip(btn_search, _("Find devices"))

        box = gtk.HBox()
        box.pack_start(cbentry, True, True, 0)
        box.pack_end(btn_search, False, False, 0)

        item = gtk.ToolItem()
        item.add(box)
        item.set_expand(True)

        return item
Example #15
0
    def __init__(self):
        HIGVBox.__init__(self)
        self.set_spacing(12)

        table = HIGTable()
        self.hbox = HIGHBox()

        self.description = HIGEntryLabel(
            _("""You wish to create a new profile,\
 or just want to quickly create a command and run it once?"""))
        self.profile_radio = gtk.RadioButton(None, _('Profile'))
        self.command_radio = gtk.RadioButton(self.profile_radio, _('Command'))
        self.command_radio.connect('toggled', self.enable_target)
        self.profile_radio.connect('toggled', self.disable_target)

        self.target_label = HIGEntryLabel(_("Target"))
        self.target_entry = gtk.Entry()
        self.set_completion()

        self.hbox._pack_noexpand_nofill(hig_box_space_holder())
        self.hbox._pack_noexpand_nofill(self.target_label)
        self.hbox._pack_expand_fill(self.target_entry)

        self.bar = ForwardBar()

        self._pack_noexpand_nofill(self.description)
        self._pack_expand_fill(table)
        self._pack_noexpand_nofill(self.bar)

        table.attach(self.profile_radio, 0, 1, 0, 1, yoptions=0)
        table.attach(self.command_radio, 0, 1, 1, 2, yoptions=0)
        table.attach(self.hbox, 0, 1, 2, 3, yoptions=0)

        self.disable_target()
Example #16
0
    def __init__(self):
        """
        """
        super(SaveDialog, self).__init__(
            title=_("Save Topology"),
            action=gtk.FILE_CHOOSER_ACTION_SAVE,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK),
        )

        self.__combo = gtk.combo_box_new_text()

        types_list = TYPES.keys()
        types_list.sort()

        for i in types_list:
            self.__combo.append_text(i)

        self.__combo.set_active(1)
        self.__label = HIGLabel(_("Select the output type:"))

        self.__hbox = HIGHBox()
        self.__hbox._pack_noexpand_nofill(self.__label)
        self.__hbox._pack_expand_fill(self.__combo)

        self.set_extra_widget(self.__hbox)
        self.set_do_overwrite_confirmation(True)

        self.__hbox.show_all()
Example #17
0
    def _create_widgets(self):
        """ Create widgets"""

        self._frm_option = HIGFrame(_('Options'))
        self._box_option = HIGHBox()
        self.__lbl_file_opt = HIGEntryLabel(_('File:'))
        self.__entry_file_opt = HIGTextEntry()
        self.__entry_file_opt.set_editable(False)
        self.__file_browser_opt = HIGButton(_('Browse file'), \
                                            gtk.STOCK_DIRECTORY)

        self._frm_profile = HIGFrame(_('Profile'))
        self._box_profile = HIGHBox()
        self.__lbl_file_profile = HIGEntryLabel(_('File:'))
        self.__entry_file_profile = HIGTextEntry()
        self.__entry_file_profile.set_editable(False)
        self.__file_browser_profile = HIGButton(_('Browse file'), \
                                            gtk.STOCK_DIRECTORY)

        self._frm_wizard = HIGFrame(_('Wizard'))
        self._box_wizard = HIGHBox()

        self.__lbl_file_wizard = HIGEntryLabel(_('File:'))
        self.__entry_file_wizard = HIGTextEntry()
        self.__entry_file_wizard.set_editable(False)
        self.__file_browser_wizard = HIGButton(_('Browse file'), \
                                            gtk.STOCK_DIRECTORY)

        self.__btn_restore = HIGButton(_('Restore Defaults'), gtk.STOCK_CLEAR)
Example #18
0
    def __pack_widgets(self):
        self.add(self.vbox)

        self.vbox.pack_start(self.animated_bar, False, False, 0)
        self.vbox.pack_start(self.toolbar, False, False, 0)
        self.vbox.pack_start(self.notebook)

        self.notebook.append_page(self.plug_page)
        self.notebook.append_page(self.path_page)

        self.toolbar.connect('changed', self.__on_switch_page)

        self.connect('realize', self.__on_realize)

        # Create the pages

        lbls = (_('Extensions'), _('Paths'))
        imgs = ('extension_small', 'paths_small')

        for lbl, stock in zip(lbls, imgs):
            image = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)

            self.toolbar.append(
                HIGToolItem('<b>%s</b>' % lbl, image)
            )

        self.toolbar.set_active(0)
        self.get_child().show_all() # No show the root

        # We have to hide unused buttons in plugin page
        self.plug_page.install_updates_btn.hide()
        self.plug_page.skip_install_btn.hide()
        self.plug_page.restart_btn.hide()

        self.connect('delete-event', self.__on_delete_event)
Example #19
0
 def __init__(self, type_ = None, path = None):
     if type_ and path:
         title = _("Edit Source")
     else:
         type_ = "FILE"
         path = ""
         title = _("Add Source")
     HIGDialog.__init__(self, title, None,
                        gtk.DIALOG_MODAL,
                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                         gtk.STOCK_OK, gtk.RESPONSE_OK))
     hbox = HIGHBox()
     self.combo = gtk.combo_box_new_text()
     types = sorted(self.types.keys())
     for t in types:
         self.combo.append_text(t)
     self.combo.set_active(types.index(type_))
     self.combo.connect("changed", self._changed_cb)
     hbox.pack_start(self.combo, False, False)
     self.entry = HIGTextEntry()
     self.entry.set_text(path)
     hbox.pack_start(self.entry)
     self.btn = HIGButton(_("Browse..."), stock=gtk.STOCK_OPEN)
     self.btn.connect("clicked", self._clicked_cb)
     hbox.pack_start(self.btn, False, False)
     self.vbox.add(hbox)
     self.show_all()
     self.update()
    def _run_inv_scan(self, widget, inv):
        """
        Run Inventory scan.
        """
        if self.daddy:
            inv_id = self.daddy.invdb.get_inventory_id_for_name(inv)
            if not inv_id:

                scan_args = self._get_command_from_schemas(inv)
                if not scan_args:
                    return

            else:
                scan_args = (
                    self.daddy.invdb.get_scan_args_for_inventory_id(inv_id))
                if not scan_args:
                    scan_args = self._get_command_from_schemas(inv)
                    if not scan_args:
                        return

            scan = NmapCommand(scan_args)
            scan.run_scan()

            if not self.running_scans:
                # no scans running, start timer for checking if some scan
                # finished
                self.scans_timer = gobject.timeout_add(4200, self._check_scans)

            self.running_scans[scan] = inv
            running_scans = len(self.running_scans)
            self.daddy._write_statusbar(("%d " % running_scans) +
                                        append_s(_("scan"), running_scans) +
                                        _(" running"))
Example #21
0
    def create_widgets(self):
        vbox = HIGVBox()

        self.btn_internal = gtk.RadioButton(None, _("Internal Editor"))
        vbox.pack_start(self.btn_internal, False, False)

        self.btn_external = gtk.RadioButton(self.btn_internal, _("External Editor"))
        vbox.pack_start(self.btn_external, False, False)

        self.external_cmd = gtk.Entry()
        self.external_cmd.set_text(self.preferences.external_command)
        vbox.pack_start(HIGSpacer(self.external_cmd), False, False)

        self.btn_external.connect("toggled",
                                  lambda b: self._update_use_editor())
	
	self.external_cmd.connect("focus-out-event",
                                       self._update_external_command)

        if self.preferences.use_internal_editor:
            self.btn_internal.set_active(True)
            self.external_cmd.set_sensitive(False)
        else:
            self.btn_external.set_active(True)
            self.external_cmd.set_sensitive(True)
        
        self.pack_start(HIGSpacer(vbox), False, False)
Example #22
0
    def create_widgets(self):
	vboxmain = gtk.VBox()
	sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
	
	self.store = gtk.ListStore(str)	
        self.update_model()
	self.treeView = gtk.TreeView(self.store)
	#treeView.connect("row-activated", self.on_activated)
	#treeView.set_rules_hint(True)
	self.create_columns(self.treeView)
	sw.add(self.treeView)
		
	# buttons
        vbox = HIGVBox()

        btn = HIGButton(_("Edit..."), gtk.STOCK_EDIT)
        vbox.pack_start(btn, False, False)
        btn.connect("clicked", self._edit_template)
        
        btn = HIGButton(_("Remove"), gtk.STOCK_REMOVE)
        vbox.pack_start(btn, False, False)
        btn.connect("clicked", self._remove_template)
	
	hbox = HIGHBox()
	hbox.pack_start(sw, True, True)
	hbox.pack_start(vbox, False, False)
	vboxmain.pack_start(hbox, True, True, 0)
	self.add(vboxmain)
        self.show_all()	
Example #23
0
    def open_file (self, widget):
        file_chooser = ResultsFileChooserDialog(_("Select Scan Result"))
        
        file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()

        if check_access(file_chosen, os.R_OK):
            try:
                parser = NmapParser(file_chosen)
                parser.parse()
            except:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('File is not a Umit \
Scan Result'),
                    secondary_text=_("Selected file is not a Umit Scan \
Result file. Umit can not parse this file. Please, select another."))
                alert.run()
                alert.destroy()
                return False

            scan_name = os.path.split(file_chosen)[-1]
            self.add_scan(scan_name, parser)
            
            self.combo_scan.set_active(len(self.list_scan) - 1)
        else:
            alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % \
                                   _('Can not open selected file'),
                    secondary_text=_("Umit can not open selected file. Please, \
select another."))
            alert.run()
            alert.destroy()
Example #24
0
    def __create_widgets(self):
        self.vbox = HIGVBox()
        self.hbox = HIGHBox()
        self.img_logo = gtk.Image()
        self.event_img_logo = gtk.EventBox()
        self.img = 1
        
        self.d = {}
        for c in (65, 97):
            for i in range(26):
                self.d[chr(i+c)] = chr((i+13) % 26 + c)
        
        self.lbl_program_version = gtk.Label("""\
<span size='30000' weight='heavy'>Umit %s</span>""" % VERSION)
        
        self.lbl_program_description = gtk.Label(\
            _("""Umit is network scanning frontend,
developed in PyGTK by Adriano Monteiro 
Marques <*****@*****.**>
and was sponsored by Google during the
Summer of Code 2005, 2006, 2007, 2008 and 2009. Thanks Google!"""))
        
        self.lbl_copyright=gtk.Label("<small>Copyright (C) 2005-2006 \
Insecure.Com LLC. and (C) 2007-2009 Adriano Monteiro Marques</small>")
        
        self.lbl_program_website = gtk.Label(\
            "<span underline='single' \
            foreground='blue'>http://www.umitproject.org</span>")
        
        self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE)
        self.btn_credits = HIGButton(_("Credits"))
Example #25
0
    def set_enabled(self, val):
        self._enabled = val

        # We need more testing on color/saturate on enabled

        if self._enabled:
            self.action_btn.set_label(_("Disable"))
            self.action_btn.set_image(self.img_stop)

            #
            color = self.style.text[gtk.STATE_NORMAL]
            self.saturate = False
        else:
            self.action_btn.set_label(_("Enable"))
            self.action_btn.set_image(self.img_play)

            #
            color = self.style.text[gtk.STATE_INSENSITIVE]
            self.saturate = True

        self.label.set_text( \
            "<span color=\"%s\">"
            "<span size=\"x-large\" weight=\"bold\">%s</span>" \
            "    %s" \
            "\n<tt>%s</tt>" \
            "</span>" % \
            ( \
                color.to_string(), \
                self._reader.name, \
                self._reader.version, \
                self._message \
            ) \
        )
        self.label.set_use_markup(True)
Example #26
0
    def get_networks(self, event):
        """
        Try to detect network(s).
        """
        networks = tryto_detect_networks()

        if not networks:
            dlg = HIGAlertDialog(self,
                message_format=_("No network(s) detected."),
                secondary_text=_("You will need to especify the "
                    "network(s) yourself before detecting hosts."))
            dlg.run()
            dlg.destroy()
            return

        entries = len(self.networks_box.get_children()) - 1

        for amount, nw in enumerate(networks):
            if amount == entries:
                e = gtk.Entry()
                e.set_text('')
                e.show()
                self.networks_box.add(e)
                entries += 1

            entry = self.networks_box.get_children()[amount]
            entry.set_text(nw.cidr_netaddress())
    def __create_widgets(self):
        """
        """
        self.__cell_text = gtk.CellRendererText()
        self.__cell_pixbuf = gtk.CellRendererPixbuf()

        self.__hosts_store = gtk.ListStore(gtk.gdk.Pixbuf, str)

        self.__hosts_treeview = gtk.TreeView(self.__hosts_store)
        self.__hosts_treeview.connect('cursor-changed', self.__cursor_callback)

        self.__hosts_column = list()

        self.__column_type = gtk.TreeViewColumn(_('Type'),
                                                self.__cell_pixbuf,
                                                pixbuf=0)
        self.__column_host = gtk.TreeViewColumn(_('Host'),
                                                self.__cell_text,
                                                text=1)

        self.__column_type.set_reorderable(True)
        self.__column_type.set_resizable(False)
        self.__column_host.set_reorderable(True)
        self.__column_host.set_resizable(False)

        self.__hosts_treeview.append_column(self.__column_type)
        self.__hosts_treeview.append_column(self.__column_host)

        self.__hosts_store.set_sort_func(0, self.__sort_type)
        self.__hosts_store.set_sort_func(1, self.__sort_host)

        self.add(self.__hosts_treeview)

        self.__hosts_treeview.set_cursor((0, ))
        self.__cursor_callback(self.__hosts_treeview)
Example #28
0
    def open_file(self, widget):
        file_chooser = ResultsFileChooserDialog(_("Select Scan Result"))

        file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()

        if check_access(file_chosen, os.R_OK):
            try:
                parser = NmapParser(file_chosen)
                parser.parse()
            except:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('File is not a Umit \
Scan Result'),
                    secondary_text=_("Selected file is not a Umit Scan \
Result file. Umit can not parse this file. Please, select another."))
                alert.run()
                alert.destroy()
                return False

            scan_name = os.path.split(file_chosen)[-1]
            self.add_scan(scan_name, parser)

            self.combo_scan.set_active(len(self.list_scan) - 1)
        else:
            alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % \
                                   _('Can not open selected file'),
                    secondary_text=_("Umit can not open selected file. Please, \
select another."                ))
            alert.run()
            alert.destroy()
Example #29
0
    def _run_inv_scan(self, widget, inv):
        """
        Run Inventory scan.
        """
        if self.daddy:
            inv_id = self.daddy.invdb.get_inventory_id_for_name(inv)
            if not inv_id:

                scan_args = self._get_command_from_schemas(inv)
                if not scan_args:
                    return

            else:
                scan_args = (
                    self.daddy.invdb.get_scan_args_for_inventory_id(inv_id))
                if not scan_args:
                    scan_args = self._get_command_from_schemas(inv)
                    if not scan_args:
                        return


            scan = NmapCommand(scan_args)
            scan.run_scan()

            if not self.running_scans:
                # no scans running, start timer for checking if some scan
                # finished
                self.scans_timer = gobject.timeout_add(4200, self._check_scans)

            self.running_scans[scan] = inv
            running_scans = len(self.running_scans)
            self.daddy._write_statusbar(("%d " % running_scans) +
                    append_s(_("scan"), running_scans) + _(" running"))
Example #30
0
    def searchcombo(self):
        """
        Create and return a ToolItem with an entry combobox.
        """
        cbentry = gtk.combo_box_entry_new_text()
        cbentry.append_text(_("Search term"))
        cbentry.set_active(0)
        cbentry.remove_text(0) # remove "Search Term" from searchcombo
        cbentry.child.connect('key-press-event', self.comboentry_press)
        cbentry.show()

        btn_search = gtk.Button(stock=gtk.STOCK_FIND)
        btn_search.connect('clicked', self.perform_search, cbentry.child)
        btn_search.show()
        lbl = btn_search.get_children()[0].get_children()[0].get_children()[1]
        lbl.set_label("")
        self.tooltips.set_tip(btn_search, _("Find devices"))

        box = gtk.HBox()
        box.pack_start(cbentry, True, True, 0)
        box.pack_end(btn_search, False, False, 0)

        item = gtk.ToolItem()
        item.add(box)
        item.set_expand(True)

        return item
    def get_networks(self, event):
        """
        Try to detect network(s).
        """
        networks = tryto_detect_networks()

        if not networks:
            dlg = HIGAlertDialog(
                self,
                message_format=_("No network(s) detected."),
                secondary_text=_(
                    "You will need to especify the "
                    "network(s) yourself before detecting hosts."))
            dlg.run()
            dlg.destroy()
            return

        entries = len(self.networks_box.get_children()) - 1

        for amount, nw in enumerate(networks):
            if amount == entries:
                e = gtk.Entry()
                e.set_text('')
                e.show()
                self.networks_box.add(e)
                entries += 1

            entry = self.networks_box.get_children()[amount]
            entry.set_text(nw.cidr_netaddress())
Example #32
0
    def __init__(self):
        HIGVBox.__init__(self)
        self.set_spacing(12)
        
        table = HIGTable()
        self.hbox = HIGHBox()
        
        self.description = HIGEntryLabel(_("""You wish to create a new profile,\
 or just want to quickly create a command and run it once?"""))
        self.profile_radio = gtk.RadioButton(None, _('Profile'))
        self.command_radio = gtk.RadioButton(self.profile_radio, _('Command'))
        self.command_radio.connect('toggled', self.enable_target)
        self.profile_radio.connect('toggled', self.disable_target)
        
        self.target_label = HIGEntryLabel(_("Target"))
        self.target_entry = gtk.Entry()
        self.set_completion()
        
        self.hbox._pack_noexpand_nofill(hig_box_space_holder())
        self.hbox._pack_noexpand_nofill(self.target_label)
        self.hbox._pack_expand_fill(self.target_entry)
        
        self.bar = ForwardBar()
        
        self._pack_noexpand_nofill(self.description)
        self._pack_expand_fill(table)
        self._pack_noexpand_nofill(self.bar)
        
        table.attach(self.profile_radio,0,1,0,1, yoptions=0)
        table.attach(self.command_radio,0,1,1,2, yoptions=0)
        table.attach(self.hbox,0,1,2,3, yoptions=0)
        
        self.disable_target()
Example #33
0
 def create(self, name):
     if name == "profile":
         return InterfaceProfile(_('InterfaceEditor Profile'))
     elif name == "wizard":
         return InterfaceWizard(_('InterfaceEditor Wizard'))
     elif name == "options":
         return InterfaceOptions(_('InterfaceEditor Options'))
Example #34
0
    def profile_forward(self, widget):
        profile_name = self.directions['Profile'].profile_entry.get_text()

        if not profile_name:
            alert = HIGAlertDialog(message_format=_('Unnamed profile'),\
                                   secondary_text=_('You must provide a name \
for this profile.'))
        elif profile_name.lower() == 'default':
            alert = HIGAlertDialog(message_format=_('Reserved profile name'),\
                                   secondary_text=_('Cannot assign "default" \
name to this profile. Please rename it and retry.'))
        else:
            alert = None

        if alert:

            alert.run()
            alert.destroy()

            self.directions['Profile'].profile_entry.grab_focus()

            return None

        self.main_vbox.remove(self.directions['Profile'])
        self.main_vbox._pack_expand_fill(self.directions['Command'])
        self.directions['Profile'].hide()
        self.directions['Command'].show_all()
        self.directions['LastPage'] = self.directions['Profile']
Example #35
0
    def set_enabled(self, val):
        self._enabled = val

        # We need more testing on color/saturate on enabled

        if self._enabled:
            self.action_btn.set_label(_("Disable"))
            self.action_btn.set_image(self.img_stop)

            #
            color = self.style.text[gtk.STATE_NORMAL]
            self.saturate = False
        else:
            self.action_btn.set_label(_("Enable"))
            self.action_btn.set_image(self.img_play)

            #
            color = self.style.text[gtk.STATE_INSENSITIVE]
            self.saturate = True

        self.label.set_text( \
            "<span color=\"%s\">"
            "<span size=\"x-large\" weight=\"bold\">%s</span>" \
            "    %s" \
            "\n<tt>%s</tt>" \
            "</span>" % \
            ( \
                color.to_string(), \
                self._reader.name, \
                self._reader.version, \
                self._message \
            ) \
        )
        self.label.set_use_markup(True)
    def __create_widgets(self):
        """
        """
        self.__cell_text = gtk.CellRendererText()
        self.__cell_pixbuf = gtk.CellRendererPixbuf()

        self.__hosts_store = gtk.ListStore(gtk.gdk.Pixbuf, str)

        self.__hosts_treeview = gtk.TreeView(self.__hosts_store)
        self.__hosts_treeview.connect('cursor-changed', self.__cursor_callback)

        self.__hosts_column = list()

        self.__column_type = gtk.TreeViewColumn(_('Type'),
                                                self.__cell_pixbuf,
                                                pixbuf=0)
        self.__column_host = gtk.TreeViewColumn(_('Host'),
                                                self.__cell_text,
                                                text=1)

        self.__column_type.set_reorderable(True)
        self.__column_type.set_resizable(False)
        self.__column_host.set_reorderable(True)
        self.__column_host.set_resizable(False)

        self.__hosts_treeview.append_column(self.__column_type)
        self.__hosts_treeview.append_column(self.__column_host)

        self.__hosts_store.set_sort_func(0, self.__sort_type)
        self.__hosts_store.set_sort_func(1, self.__sort_host)

        self.add(self.__hosts_treeview)

        self.__hosts_treeview.set_cursor((0,))
        self.__cursor_callback(self.__hosts_treeview)
Example #37
0
    def choose_forward(self, widget):
        if self.directions['Choose'].command_radio.get_active():
            if self.directions['Choose'].target_entry.get_text() == '':
                alert = HIGAlertDialog(message_format=_('No target selected!'),\
                                   secondary_text=_('You must provide a target \
to be scanned.'))
                alert.run()
                alert.destroy()
            
                self.directions['Choose'].target_entry.grab_focus()
                
                return None
        
        self.main_vbox.remove(self.directions['Choose'])
        self.directions['Choose'].hide()
        if self.directions['Choose'].profile_radio.get_active():
            self.main_vbox._pack_expand_fill(self.directions['Profile'])
            self.directions['Profile'].show_all()
            
            self.directions['LastPage'] = self.directions['Profile']
            self.directions['Profile'].prof = True
            self.target = '<target>'
        else:
            self.main_vbox._pack_expand_fill(self.directions['Command'])
            self.directions['Command'].show_all()
            
            self.directions['LastPage'] = self.directions['Choose']
            self.directions['Profile'].prof = False
            self.target = self.directions['Choose'].target_entry.get_text()
            self.directions['Choose'].add_new_target(self.target)
        
        self.update_command()
Example #38
0
    def create_and_attach_widgets(self):
        self.option_label = HIGSectionLabel('New Option')
        self.attach(self.option_label, 0, 3, 0, 1)

        self.name_label = HIGEntryLabel(_('Name:'))
        self.name_entry = HIGTextEntry()
        self.attach(self.name_label, 0,1,1,2)
        self.attach(self.name_entry, 1,3,1,2)

        self.hint_label = HIGEntryLabel(_('Hint:'))
        self.hint_entry = HIGTextEntry()
        self.attach(self.hint_label, 0,1,2,3)
        self.attach(self.hint_entry,1,3,2,3)

        self.need_root = gtk.CheckButton(_('Need root'))
        self.attach(self.need_root, 0,1,3,4)	



        self.options_label = HIGEntryLabel(_('Options:'))
        hbox = HIGHBox()
        self.options_entry = HIGTextEntry()
        self.insert_arg_button = HIGButton(title='Args', stock='gtk-add')
        self.insert_arg_button.connect('clicked', self.update_args)
        self.attach(self.options_label,0,1,4,5)
        self.attach(self.options_entry, 1,2,4,5)
        self.attach(self.insert_arg_button, 2,3, 4, 5)

        self.aguments_label = HIGEntryLabel(_('Arguments:'))
        self.arguments_entry = HIGTextEntry()
        self.arguments_entry.set_editable(False)
        self.attach(self.aguments_label, 0,1, 5,6)
        self.attach(self.arguments_entry, 1,3,5,6)
    def __init__(self, title=_('Bug Report'), summary=None, description=None,
                 category=None, crashreport=False, description_dialog=None,
                 reuse_mainloop=True):
        HIGDialog.__init__(self, title=title,
            buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))

        # If reuse_mainloop is true, then dialogs created inside this dialog
        # will not start another mainloop.
        self._reuse_mainloop = reuse_mainloop

        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.crashreport = crashreport
        self.description_dialog = description_dialog
        self._create_widgets()
        self._set_category_list()
        self._pack_widgets()
        self._connect_widgets()
        self.summary = summary or ''
        self.description_report = description
        if self.crashreport:
            self.description = _("CrashReport automatically created")
        else:
            if self.description_dialog is None:
                self.description = description or ''
            else:
                self.description = description_dialog or ''
        self.category = category or ''
Example #40
0
    def profile_forward(self, widget):
        profile_name = self.directions['Profile'].profile_entry.get_text()

        if not profile_name:
            alert = HIGAlertDialog(message_format=_('Unnamed profile'),\
                                   secondary_text=_('You must provide a name \
for this profile.'                  ))
        elif profile_name.lower() == 'default':
            alert = HIGAlertDialog(message_format=_('Reserved profile name'),\
                                   secondary_text=_('Cannot assign "default" \
name to this profile. Please rename it and retry.'                                                  ))
        else:
            alert = None

        if alert:

            alert.run()
            alert.destroy()

            self.directions['Profile'].profile_entry.grab_focus()

            return None

        self.main_vbox.remove(self.directions['Profile'])
        self.main_vbox._pack_expand_fill(self.directions['Command'])
        self.directions['Profile'].hide()
        self.directions['Command'].show_all()
        self.directions['LastPage'] = self.directions['Profile']
Example #41
0
    def __pack_widgets(self):
        self.add(self.vbox)

        self.vbox.pack_start(self.animated_bar, False, False, 0)
        self.vbox.pack_start(self.toolbar, False, False, 0)
        self.vbox.pack_start(self.notebook)

        self.notebook.append_page(self.plug_page)
        self.notebook.append_page(self.path_page)

        self.toolbar.connect('changed', self.__on_switch_page)

        self.connect('realize', self.__on_realize)

        # Create the pages

        lbls = (_('Extensions'), _('Paths'))
        imgs = ('extension_small', 'paths_small')

        for lbl, stock in zip(lbls, imgs):
            image = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)

            self.toolbar.append(HIGToolItem('<b>%s</b>' % lbl, image))

        self.toolbar.set_active(0)
        self.get_child().show_all()  # No show the root

        # We have to hide unused buttons in plugin page
        self.plug_page.install_updates_btn.hide()
        self.plug_page.skip_install_btn.hide()
        self.plug_page.restart_btn.hide()

        self.connect('delete-event', self.__on_delete_event)
Example #42
0
    def _create_widgets(self):
        # Notebook
        self._nb = self
        self._create_expose()
        self._create_expose_settings()

        self._nb.append_page(self._expose_box, gtk.Label(_('Expose')))
        self._nb.append_page(self._expose_settings_box, gtk.Label(_('Advanced')))
Example #43
0
 def _adjust_target_label(self):
     """Update target_lbl according to the current scount (assumes that
     scount > 0)."""
     word = append_s(_("scan"), self.scount)
     self.target_lbl.set_label(
             _("Target list") +
             (" (%d) " % self.scount) + word +
             _(" running"))
Example #44
0
    def save_profile(self, widget):
        command = self.constructor.get_command('%s')
        close_popup = True

        if self.directions['Choose'].profile_radio.get_active():
            profile_name = self.directions['Profile'].profile_entry.get_text()

            hint = self.directions['Profile'].hint_entry.get_text()

            buffer = self.directions['Profile'].description_text.get_buffer()
            description = buffer.get_text(buffer.get_start_iter(),\
                                          buffer.get_end_iter())

            buffer = self.directions['Profile'].annotation_text.get_buffer()
            annotation = buffer.get_text(buffer.get_start_iter(),\
                                          buffer.get_end_iter())

            self.profile.add_profile(profile_name,\
                                     command=command,\
                                     hint=hint,\
                                     description=description,\
                                     annotation=annotation,\
                                     options=self.constructor.get_options())

            notebook_n_pages = 0
            if self.notebook:
                notebook_n_pages = self.notebook.get_n_pages()

            for i in xrange(notebook_n_pages):
                page = self.notebook.get_nth_page(i)
                page.toolbar.profile_entry.update()
        elif self.notebook:
            target = self.directions['Choose'].target_entry.get_text()

            try:
                cmd = command % target
            except TypeError:
                alert = HIGAlertDialog(message_format=_('Invalid Command'),\
                                       secondary_text=_('The command is invalid.'))
                alert.run()
                alert.destroy()
                close_popup = False
            else:
                current_page = self.notebook.get_nth_page(\
                    self.notebook.get_current_page())
                if current_page is None:
                    current_page = self.notebook.add_scan_page(target)

                current_page.execute_command(cmd)

                current_page.toolbar.target_entry.selected_target = self.\
                                    directions['Choose'].target_entry.get_text()
                current_page.command_toolbar.command_entry.command = cmd
                current_page.command_toolbar.set_command(cmd)
        if self.profilemanager:
            self.update_profilemanager()
        if close_popup:
            self.close_wizard()
Example #45
0
    def save_profile(self, widget):
        command = self.constructor.get_command('%s')
        close_popup = True

        if self.directions['Choose'].profile_radio.get_active():
            profile_name = self.directions['Profile'].profile_entry.get_text()

            hint = self.directions['Profile'].hint_entry.get_text()

            buffer = self.directions['Profile'].description_text.get_buffer()
            description = buffer.get_text(buffer.get_start_iter(),\
                                          buffer.get_end_iter())

            buffer = self.directions['Profile'].annotation_text.get_buffer()
            annotation = buffer.get_text(buffer.get_start_iter(),\
                                          buffer.get_end_iter())

            self.profile.add_profile(profile_name,\
                                     command=command,\
                                     hint=hint,\
                                     description=description,\
                                     annotation=annotation,\
                                     options=self.constructor.get_options())

            notebook_n_pages = 0
            if self.notebook:
                notebook_n_pages = self.notebook.get_n_pages()

            for i in xrange(notebook_n_pages):
                page = self.notebook.get_nth_page(i)
                page.toolbar.profile_entry.update()
        elif self.notebook:
            target = self.directions['Choose'].target_entry.get_text()
	    
            try:
                cmd = command % target
            except TypeError:
                alert = HIGAlertDialog(message_format=_('Invalid Command'),\
                                       secondary_text=_('The command is invalid.'))
                alert.run()
                alert.destroy()
                close_popup = False
            else:
                current_page = self.notebook.get_nth_page(\
                    self.notebook.get_current_page())
                if current_page is None:
                    current_page = self.notebook.add_scan_page(target)

                current_page.execute_command(cmd)

                current_page.toolbar.target_entry.selected_target = self.\
                                    directions['Choose'].target_entry.get_text()
                current_page.command_toolbar.command_entry.command = cmd
                current_page.command_toolbar.set_command(cmd)
        if self.profilemanager:
            self.update_profilemanager()
        if close_popup:    
            self.close_wizard()
Example #46
0
    def __init__(self):
        gtk.VBox.__init__(self)
        self.open_check = gtk.CheckButton(_("Open"))
        self.filtered_check = gtk.CheckButton(_("Filtered"))
        self.closed_check = gtk.CheckButton(_("Closed"))

        self.pack_start(self.open_check, False, False)
        self.pack_start(self.filtered_check, False, False)
        self.pack_start(self.closed_check, False, False)
Example #47
0
 def _remove_option(self, widget):
     if self.box_editable._old_selected ==None :
         d = HIGAlertDialog(type=gtk.MESSAGE_ERROR, 
                            message_format=_('Select a Option '), 
                            secondary_text=_('You do not select any option'))
         d.run()
         d.destroy()
     else:
         self.box_editable.delete_on_item(self.box_editable._old_selected)
Example #48
0
 def _remove_option(self, widget):
     if self.box_editable._old_selected == None:
         d = HIGAlertDialog(
             type=gtk.MESSAGE_ERROR,
             message_format=_('Select a Option '),
             secondary_text=_('You do not select any option'))
         d.run()
         d.destroy()
     else:
         self.box_editable.delete_on_item(self.box_editable._old_selected)
Example #49
0
 def show_error(self):
     """
     """
     alert = HIGAlertDialog(parent=self,
                            type=gtk.MESSAGE_ERROR,
                            message_format=_("Can't create file"),
                            secondary_text=_(
                                "Please check if you have permission to "
                                "write this file."))
     alert.run()
     alert.destroy()
 def _error_invalid_network(self, network):
     """
     Show error dialog for invalid network(s).
     """
     dlg = HIGAlertDialog(
         self,
         message_format=_('Invalid network(s).'),
         secondary_text=(_("There is some invalid character in network") +
                         (" %r" % network) + _("please verify.")))
     dlg.run()
     dlg.destroy()
Example #51
0
    def add_extraports_diff(self, host_parent, state, extraports1,
                            extraports2):
        if extraports1 or extraports2:
            section = _("Extraports")
            parent = self.append_parent(host_parent, section, state)
            self.set_parent_status(parent, state)

            self.diff_it(parent, "", _("Count"), extraports1.get("count"),
                         extraports2.get("count"))
            self.diff_it(parent, "", _("State"), extraports1.get("state"),
                         extraports2.get("state"))
Example #52
0
    def _create_widgets(self):
        # Notebook
        self._nb = self
        self._create_nmap_output()
        self._create_diff()
        self._create_search()

        self._nb.append_page(self._diff_box, gtk.Label(_('Diff Colors')))
        self._nb.append_page(self._nmap_box, gtk.Label(_('Nmap Results')))

        self._nb.append_page(self._search_box, gtk.Label(_('Search')))
 def update_viewing_lbl(self):
     """
     Update viewing_lbl based on viewing_rows.
     """
     vrows = len(self.viewing_rows)
     if vrows:
         self.viewing_lbl.set_label(
                 _("Viewing") + (" 1-%d " % vrows) +
                 _("of") + (" %d" % vrows))
     else:
         self.viewing_lbl.set_label(_("Nothing to view"))
    def descr_by_graphmode(self):
        """
        Returns a description with graph meaning.
        """
        graph_descr = [
            _("end of a week"), _("end of 12 hours period"),
            _("end of half hour period"), _("end of a minute")
            ]

        return _("Each point break represents ") + \
               graph_descr[view_mode_order.index(self.graph_mode)]