Exemple #1
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)
    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):

        #box
        self.all_box = HIGVBox()
        self.input_box = HIGHBox()
        self.buttom_box = HIGHBox()
        self.check_btn_box = gtk.HButtonBox()

        #Add input
        self.title_text = HIGLabel(_("Locations"))
        self.longitude_text = HIGLabel(_("longitude:"))
        self.longitude_entry = HIGTextEntry()
        self.latitude_text = HIGLabel(_("latitude:"))
        self.latitude_entry = HIGTextEntry()

        #Add buttons
        self.get_event_btn = gtk.Button(_("Get Events"))
        self.refresh_btn = gtk.Button(_("Refresh"))

        #status bar
        self.statusbar = gtk.Statusbar()
        self.statusbar.push(0, 'Events in Database')

        self.listmodel = gtk.ListStore(str, str, str, str, str)

        # create the TreeView
        self.treeview = gtk.TreeView()

        # create the TreeViewColumns to display the data
        self.tvcolumn = [None] * len(self.column_names)
        cellpb = gtk.CellRendererText()

        self.tvcolumn[0] = gtk.TreeViewColumn(self.column_names[0], cellpb)
        self.tvcolumn[0].add_attribute(cellpb, 'text', 0)
        #cell = gtk.CellRendererText()
        #self.tvcolumn[0].set_cell_data_func(cell, self.test_type)
        self.treeview.append_column(self.tvcolumn[0])

        for n in range(1, len(self.column_names)):
            cell = gtk.CellRendererText()
            self.tvcolumn[n] = gtk.TreeViewColumn(self.column_names[n], cell)
            self.tvcolumn[n].add_attribute(cell, 'text', n)
            if n == 1:
                cell.set_property('xalign', 1.0)
            #self.tvcolumn[n].set_cell_data_func(cell, cell_data_funcs[n])
            self.treeview.append_column(self.tvcolumn[n])

        #self.treeview.connect('row-activated', self.open_file)
        self.scrolledwindow = gtk.ScrolledWindow()
        self.scrolledwindow.add(self.treeview)
        self.treeview.set_model(self.listmodel)
 def __init__(self):
     self.qs_data = QSData()
     self.entry = HIGTextEntry()
     self.entry.set_visibility(True)
     self.status = Status()
     self.status.set_empty()
     self.scan_result = Result()
     self.b_text = ""
     self.rgx_is_domain = "^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}"
     self.rgx_is_domain += "([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)"
     self.rgx_is_domain += "(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?"
     
     self.completion = gtk.EntryCompletion()
     self.entry.set_max_length(1000)
     
     # add button to launch result in umit
     self.btn_umit = gtk.Button ("Open Result")
     
     self.results_opened = False
     self.nmap_output = None
     
     self.load_data(None)
      
     self.btn_umit.connect("clicked", self._launch_umit, None)
     
     self.entry.show()
Exemple #5
0
    def _create_widgets(self):
        '''
        Create the main entrys of the option 
        '''
        self._box = HIGVBox()

        self._table = HIGTable()

        #Name
        self._label_name = HIGEntryLabel(_('Name'))
        self._entry_name = HIGTextEntry()

        self._entry_name.connect('activate', self._update_label)

        #Type
        self._label_type = HIGEntryLabel(_('Type'))
        self._combo_type = gtk.combo_box_new_text()
        self._combo_type.append_text('')
        self._combo_type.append_text('Option List')
        self._combo_type.append_text('Option Check')
        self._combo_type.set_active(0)
        self._combo_type.connect('changed', self.change_combo)

        self._label_opt = HIGEntryLabel(_('Option'))
        self._entry_opt = HIGTextEntry()
        self._entry_opt.set_sensitive(False)

        #For option list open a dialog to add/remove options
        self._button_list = HIGButton('Edit Option List')
        img = gtk.Image()
        img_dir = os.path.join(pixmaps_dir, 'uie', 'combo.png')
        img.set_from_file(img_dir)
        self._button_list.set_image(img)
        self._button_list.connect('button-press-event',
                                  self._button_list_clicked)

        self._table.attach(self._label_name, 0, 1, 0, 1)
        self._table.attach(self._entry_name, 1, 2, 0, 1)
        self._table.attach(self._label_type, 0, 1, 1, 2)
        self._table.attach(self._combo_type, 1, 2, 1, 2)

        self._table.attach(self._button_list, 0, 2, 3, 4)
        self._table.attach(self._label_opt, 0, 1, 4, 5)
        self._table.attach(self._entry_opt, 1, 2, 4, 5)

        self._box.pack_start(self._table, False, False)
Exemple #6
0
    def _create_widgets(self):

        #Username
        self.username_label = HIGLabel(_("Username"))
        self.username_entry = HIGTextEntry()
        self.username_entry.set_activates_default(True)

        #Password
        self.password_label = HIGLabel(_("Password"))
        self.password_entry = HIGPasswordEntry()
        self.password_entry.set_activates_default(True)

        #Logo
        self.logo_openmonitor = gtk.gdk.pixbuf_new_from_file\
                                    (os.path.join(IMAGES_DIR, 'logoOM.png'))
        self.logo_image = gtk.Image()
        self.logo_image.set_from_pixbuf(self.logo_openmonitor)
        #self.login_text = gtk.Label(_("Log into your ICM agent."))

        #Register
        #self.register_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,_("Register"))
        self.register_label = \
            gtk.Label(_("<span foreground='blue'>" \
                        "Register id</span>"))
        self.register_label.set_use_markup(True)
        self.register_button = gtk.Button()
        self.register_button.add(self.register_label)
        self.register_button.set_relief(gtk.RELIEF_NONE)

        #Forget Password
        self.forgot_password_label = \
            gtk.Label(_("<span foreground='blue'>" \
                        "Forgot password?</span>"))
        self.forgot_password_label.set_use_markup(True)
        self.forgot_password = gtk.Button()
        self.forgot_password.add(self.forgot_password_label)
        self.forgot_password.set_relief(gtk.RELIEF_NONE)

        #Auto Login
        self.auto_login_checkbtn = gtk.CheckButton(_("Auto login"))

        #Settings
        self.settings_button = HIGStockButton(gtk.STOCK_DIALOG_INFO,
                                              _("settings"))

        #Container
        self.hbox = HIGHBox(False, 2)
        self.table = HIGTable(8, 4, False)
        self.table.set_row_spacings(5)
        self.table.set_col_spacings(10)
        self.action_area.set_homogeneous(False)

        #tab orders
        self.orders = [
            self.username_entry, self.password_entry, self.register_button,
            self.forgot_password
        ]
    def __init__(self, text):
        HIGDialog.__init__(self, _('Profile\'s Name'))

        dialog_label = HIGDialogLabel(text)
        dialog_label.show()
        self.vbox.pack_start(dialog_label)
        self.entry_text = HIGTextEntry()
        self.entry_text.show()
        self.vbox.pack_start(self.entry_text)
        self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
Exemple #8
0
    def _create_widgets_common(self):
        """ generally tab """
        self._box_common = HIGVBox() # pack main section
        self.__check_splash = gtk.CheckButton(_('Enable Splash on start'))
        self.__check_silent_root = gtk.CheckButton(\
            _('Silent Warning Non-Root'))
        self.__check_warning_extensions = gtk.CheckButton(\
            _('Set/Check extensions - Windows only'))
        self._box_common.pack_start(self.__check_splash, False, False)
        #self._box_common.pack_start(self.__check_warning_extensions, False, \
        #                            False)
        self._box_common.pack_start(self.__check_silent_root, False, False)
        self.__label_nmap = HIGEntryLabel(_('Nmap Command'))
        self.__entry_nmap = HIGTextEntry()
        # Files usr saved on predefined directory:
        self.__label_path = HIGEntryLabel(_('Nmap Command'))
        self.__entry_path = HIGTextEntry()
        self.__button_path = HIGButton(_('Choose'))
        self.__box_path = HIGHBox()
        self.__box_path.pack_start(self.__label_path, False, False)
        self.__box_path.pack_end(self.__button_path, False, False)

        self._box_common.set_border_width(0)
    def dialog_args(self):
        '''
        Create a dialog
        '''

        d = HIGDialog(_('Arguments'))
        description_label = HIGEntryLabel(
            _('Insert the description to argument:'))
        description_label.show()
        description_entry = HIGTextEntry()
        text = self.arguments_entry.get_text()
        description_entry.set_text(text)
        description_entry.show()

        combo_box = gtk.combo_box_new_text()
        combo_box.set_wrap_width(1)
        index = -1
        j = 0
        for i in ARG_TYPES:
            combo_box.append_text(ARG_TYPES[i])
            if i == self.arg_type:
                index = j
            j = j + 1
        if index > -1:
            combo_box.set_active(index)
        combo_box.show()
        d.vbox.pack_start(description_label, False, False)
        d.vbox.pack_start(description_entry, False, False)
        d.vbox.pack_start(combo_box, False, False)
        d.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        d.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
        resp = d.run()
        result = None, None
        if resp == gtk.RESPONSE_OK:
            model = combo_box.get_model()
            active = combo_box.get_active()
            if active < 0:
                return None, None
            combo_selected = model[active][0]

            for i in ARG_TYPES:
                if combo_selected == ARG_TYPES[i]:
                    combo_selected = i

            result = description_entry.get_text(), combo_selected
            #self.insert_arg_button.set_label('Edit args')
            #self.insert_arg_button.
        d.destroy()
        return result
    def __create_widgets(self):

        self.vbox_main = HIGVBox()

        self.main_frame = HIGFrame("Profiles")
        #self.main_frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT)

        self.align = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
        self.align.set_padding(0, 0, 12, 0)

        self.vbox = HIGVBox()
        self.profiles_sw = HIGScrolledWindow()
        #TreeView
        self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
        #self.modelfilter = self.model.filter_new()
        self.profiles_tv = gtk.TreeView(self.model)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Name"), renderer, text=0)
        self.profiles_tv.append_column(column)
        renderer_hint = gtk.CellRendererText()
        column_hint = gtk.TreeViewColumn(_("Hint"), renderer_hint, text=1)
        self.profiles_tv.append_column(column_hint)
        #self.profiles_tv.set_model(self.modelfilter)
        #Info
        self.hbox_info = HIGHBox()
        self.command_label = HIGEntryLabel('Command: ')
        self.command_entry = HIGTextEntry()
        self.command_entry.set_editable(False)

        #Buttons
        self.hbox_buttons = HIGHBox()

        self.wiz_button = HIGButton(title='Wizard', stock='gtk-convert')
        self.wiz_button.connect("clicked", self.new_wiz)

        self.edit_button = HIGButton(stock='gtk-edit')
        self.edit_button.connect("clicked", self.open_peditor)
        self.new_button = HIGButton(stock='gtk-new')
        self.new_button.connect("clicked", self.open_peditor)
        self.copy_button = HIGButton(stock='gtk-copy')
        self.copy_button.connect("clicked", self.copy_profiles)
        self.delete_button = HIGButton(stock=gtk.STOCK_DELETE)
        self.delete_button.connect('clicked', self.delete_profile)
        #Apply Buttons
        self.cancel_button = HIGButton(stock='gtk-close')
        self.cancel_button.connect("clicked", self.quit)

        self.connect("delete-event", self.quit)
Exemple #11
0
    def _create_widgets_error(self):

        # Create Widgets
        self._box_error_frame = HIGFrame('Error')

        self._box_error = HIGTable(5, 2)
        self._box_error.set_border_width(10)
        self._box_error_frame.add(self._box_error)
        self.__crash_report = gtk.CheckButton(_('Enable Crash Report'))
        # Radio Button List
        self.__log_no = gtk.RadioButton(None, _('No log'))
        self.__log_terminal = gtk.RadioButton(self.__log_no, _('Enable log in terminal'))
        self.__log_file = gtk.RadioButton(self.__log_terminal,\
                                         _('Enable log file'))

        self.__log_file_label = HIGEntryLabel(_('Log file'))
        self.__log_file_entry = HIGTextEntry()
        self.__log_file_entry.set_editable(False)
        # FIXME: Do default file ~/.umit/umit.log
        self.__log_file_browser = HIGButton(_('Browse file'), \
                                            gtk.STOCK_DIRECTORY)

        tmpbox = HIGHBox()
        tmpbox.pack_start(self.__log_file_entry, False, False)
        tmpbox.pack_start(self.__log_file_browser, False, False)


        # attach table
        self._box_error.attach(self.__crash_report, 0,1,0,1,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
        self._box_error.attach(self.__log_no, 0,1,1,2,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
        self._box_error.attach(self.__log_terminal, 0,1,2,3,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
        self._box_error.attach(self.__log_file, 0,1,3,4,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
        self._box_error.attach(self.__log_file_label, 0,1,4,5,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
        self._box_error.attach(tmpbox, 1,2,4,5,\
                               gtk.FILL|gtk.EXPAND| gtk.SHRINK, gtk.FILL)
Exemple #12
0
    def _create_widgets_proxy(self):

        self.__frame = TabFrame(_("Proxy Settings"))
        self.__frame.set_shadow_type(gtk.SHADOW_NONE)
        self.__frame_box = HIGTable(6, 2, True)
        self._radio_no_proxy = gtk.RadioButton(None, _('No proxy server'))
        self._radio_proxy = gtk.RadioButton(self._radio_no_proxy,
                                            _('Configure server'))

        # Core Structure of data of proxy:

        fields = []
        fields.append({
            'name': 'hostname',
            'label': _('Hostname'),
            'values': network_conf.hostname,
            'entry': None
        })

        fields.append({
            'name': 'port',
            'label': _('Port'),
            'values': network_conf.port,
            'entry': None,
            'type': 'spin'
        })

        fields.append({
            'name': 'username',
            'label': _('Username'),
            'values': network_conf.username,
            'entry': None
        })

        fields.append({
            'name': 'password',
            'label': _('Password'),
            'values': network_conf.password,
            'entry': None,
            'type': 'password'
        })

        self.__proxy_fields = fields
        # Create, attach and set values of widgets of proxy

        xopt = gtk.FILL | gtk.EXPAND | gtk.SHRINK
        yopt = gtk.FILL

        self.__frame_box.attach(self._radio_no_proxy, 0, 1, 0, 1, xopt, yopt)
        self.__frame_box.attach(self._radio_proxy, 0, 1, 1, 2)

        row = 2

        # Create list of labels/entrys
        self.__label_list = []
        self.__entry_list = []

        for field in fields:

            # Create widgets
            label = gtk.Label(field['label'])
            if field.has_key('type') and field['type'] == 'spin':
                entry = IntSpin()
            else:
                entry = HIGTextEntry()

            # Add widgets to lists
            self.__label_list.append(label)
            self.__entry_list.append(entry)
            field['entry'] = entry

            # Customize
            label.set_alignment(1.0, 0.0)

            # Attachment Table
            self.__frame_box.attach(label, 0,1,row,row+1, \
                                    xopt, yopt)
            self.__frame_box.attach(entry, 1, 2, row, row + 1)

            # Increment row
            row = row + 1

        self.__frame.add(self.__frame_box)