def __init__(self, inventory=None, edit_mode=False): """ If you want to load an inventory at startup, pass it to inventory. If you want to run this in edit mode, set to True edit_mode. """ HIGWindow.__init__(self) self.schemawin = None self.discoverywin = None self.edit_mode = edit_mode if edit_mode: self.wtitle = _("Editing Inventory") else: self.wtitle = _("New Inventory") # header self.title_markup = "<span size='16500' weight='heavy'>%s</span>" self.ttitle = HIGEntryLabel("") self.ttitle.set_line_wrap(False) self.ttitle.set_markup(self.title_markup % self.wtitle) self.umit_logo = gtk.Image() self.umit_logo.set_from_file(logo) # inventory self.invname_lbl = HIGEntryLabel(_("Inventory's name")) self.invname = gtk.Entry() self.invname.connect('changed', self._check_invname) self.invname_inuse = HIGEntryLabel(_("in use")) self.invname_inuse.set_sensitive(False) self.invenabled = gtk.CheckButton(_("Enabled")) self.invenabled.set_active(True) # scan command self.scandefault = gtk.CheckButton(_("Use default scan options")) img_info = gtk.Image() img_info.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_MENU) self.scandefault_tip = gtk.EventBox() self.scandefault_tip.add(img_info) self.scanadv = gtk.Expander(_("Use advanced scan options")) self.scan_name_lbl = HIGEntryLabel(_("Scan Profile")) self.scan_name = ProfileCombo() self.scan_name.update() self.scan_name.set_active(0) self.scan_name.connect('changed', self._set_scan_command) self.cmd_wizard = gtk.Button(stock=gtk.STOCK_CONVERT) blbl = self.cmd_wizard.get_children()[0].get_children( )[0].get_children()[1] blbl.set_text(_("Command Wizard")) self.cmd_wizard.connect('clicked', self._open_cmd_wizard) self.scan_command_lbl = HIGEntryLabel(_("Command")) self.scan_command = gtk.Entry() self.scan_command.connect('changed', self._set_scan_type) self._set_scan_command(None) self.scandefault.set_active(True) # scan target self.scantarget_lbl = HIGEntryLabel(_("Scan target")) self.scantarget = gtk.Entry() self.scantarget_discovery = HIGButton(_("Use host discovery")) self.scantarget_discovery.connect('clicked', self._open_host_discovery) # scheduling profiles self.sched_name_lbl = HIGEntryLabel(_("Scheduling Profile")) self.sched_name = gtk.combo_box_new_text() self.sched_name_edit = gtk.Button(stock=gtk.STOCK_EDIT) blbl = self.sched_name_edit.get_children()[0].get_children( )[0].get_children()[1] blbl.set_text(_("Edit Profiles")) self.sched_name_edit.connect('clicked', self._edit_schedprofiles) # bottom buttons self.help = HIGButton(stock=gtk.STOCK_HELP) self.help.connect('clicked', self._show_help) self.cancel = HIGButton(stock=gtk.STOCK_CANCEL) self.cancel.connect('clicked', self._exit) self.ok = HIGButton(stock=gtk.STOCK_OK) self.ok.connect('clicked', self._save_inventory_and_leave) self.tooltips = gtk.Tooltips() self.tooltips.set_tip(self.scandefault_tip, _("nmap -T Aggressive -sV -n -O -v target")) # disable controls if edit_mode=True if edit_mode: self.invname.set_sensitive(False) self.scandefault.set_sensitive(False) self.scandefault_tip.set_sensitive(False) self.scanadv.set_sensitive(False) self.scan_name.set_sensitive(False) self.scan_command.set_sensitive(False) self.scantarget_lbl.set_sensitive(False) self.scantarget.set_sensitive(False) self.scantarget_discovery.set_sensitive(False) self.connect('destroy', self._exit) self.profile_running = None # no SchedProfileEditor instance is running. self.load_schemas() self._load_pscheds() # load an inventory if especified self.loaded_command = None if inventory: self.load_inventory(inventory) self.__set_props() self.__do_layout()
def __init__(self, daddy=None): HIGWindow.__init__(self) self.daddy = daddy self.wtitle = _("Scan Scheduler Editor") # header self.title_markup = "<span size='16500' weight='heavy'>%s</span>" self.ttitle = HIGEntryLabel("") self.ttitle.set_line_wrap(False) self.ttitle.set_markup(self.title_markup % self.wtitle) self.umit_logo = gtk.Image() self.umit_logo.set_from_file(logo) # schemas name self.schema_name_lbl = HIGEntryLabel(_("Schema Name")) self.schema_name = gtk.combo_box_entry_new_text() self.schema_name.connect('changed', self._check_schema) # target and scan profiles #self.target_lbl = HIGEntryLabel(_("Target")) #self.target = gtk.Entry() self.scan_name_lbl = HIGEntryLabel(_("Scan Profile")) self.scan_name = ProfileCombo() self.scan_name.update() self.scan_name.set_active(0) self.scan_name.connect('changed', self._set_scan_command) # scan command self.scan_command_lbl = HIGEntryLabel(_("Command")) self.scan_command = gtk.Entry() # scheduling profile self.sched_name_lbl = HIGEntryLabel(_("Scheduling Profile")) self.sched_name = gtk.combo_box_new_text() self.sched_name_edit = gtk.Button(stock=gtk.STOCK_EDIT) blbl = self.sched_name_edit.get_children()[0].get_children( )[0].get_children()[1] blbl.set_text(_("Edit Profiles")) self.sched_name_edit.connect('clicked', self._edit_schedprofiles) # schema settings self.schema_sett_frame = HIGFrame() self.setting_saveto = gtk.CheckButton(_("Save outputs to")) self.setting_saveto_entry = gtk.Entry() self.setting_saveto_browse = gtk.Button(_("...")) self.setting_saveto_browse.connect('clicked', self._select_saveto) self.setting_mailto = gtk.CheckButton(_("Send output to email")) self.setting_mailto_entry = gtk.Entry() self.setting_smtp_lbl = HIGEntryLabel(_("SMTP Schema")) self.setting_smtp = gtk.combo_box_new_text() self.setting_addtoinv = gtk.CheckButton(_("Add to the Inventory")) self.setting_enabled = gtk.CheckButton(_("Enabled")) # bottom buttons self.help = HIGButton(stock=gtk.STOCK_HELP) self.help.connect('clicked', self._show_help) self.apply = HIGButton(stock=gtk.STOCK_APPLY) self.apply.connect('clicked', self._save_schema) self.cancel = HIGButton(stock=gtk.STOCK_CANCEL) self.cancel.connect('clicked', self._exit) self.ok = HIGButton(stock=gtk.STOCK_OK) self.ok.connect('clicked', self._save_schema_and_leave) self.load_smtp_schemas() self._set_scan_command(None) self.profile_running = None # no SchedProfileEditor instance is running. self._load_pscheds() self.load_schemas() self.__set_props() self.__do_layout() self.connect('destroy', self._exit)
def _create_widgets(self): # Main widgets self.hpaned = gtk.HPaned() self.main_vbox = HIGVBox() # Results section self.result_section = HIGSectionLabel(_("Results")) self.result_vbox = HIGVBox() self.result_hbox = HIGHBox() self.result_list = gtk.ListStore(str, str, int) # title, date, id self.result_view = gtk.TreeView(self.result_list) self.result_scrolled = gtk.ScrolledWindow() self.result_title_column = gtk.TreeViewColumn(_("Scan")) self.result_date_column = gtk.TreeViewColumn(_("Date")) # Search notebook self.search_vbox = HIGVBox() self.search_notebook = gtk.Notebook() self.search_button = HIGButton(stock=gtk.STOCK_FIND) # General page self.general_vbox = HIGVBox() self.general_hbox = HIGHBox() #self.general_start_hbox = HIGHBox() #self.general_finish_hbox = HIGHBox() self.general_section = HIGSectionLabel(_("General search parameters")) self.general_table = HIGTable() self.general_option_label = HIGEntryLabel(_("Option")) self.general_profile_label = HIGEntryLabel(_("Profile")) #self.general_finished_label = HIGEntryLabel(_("Finished")) #self.general_started_label = HIGEntryLabel(_("Started")) self.general_keyword_label = HIGEntryLabel(_("Keyword")) self.general_keyword_entry = gtk.Entry() self.general_option_combo = OptionCombo() self.general_profile_combo = ProfileCombo() #self.general_started_range = DateRange() #self.general_finished_range = DateRange() # Host page self.host_vbox = HIGVBox() self.host_hbox = HIGHBox() #self.host_uptime_hbox = HIGHBox() #self.host_lastboot_hbox = HIGHBox() self.host_section = HIGSectionLabel(_("Host search parameters")) self.host_table = HIGTable() self.host_target_label = HIGEntryLabel(_("Target")) self.host_mac_label = HIGEntryLabel(_("MAC")) self.host_ipv4_label = HIGEntryLabel(_("IPv4")) self.host_ipv6_label = HIGEntryLabel(_("IPv6")) #self.host_uptime_label = HIGEntryLabel(_("Uptime")) #self.host_lastboot_label = HIGEntryLabel(_("Last boot")) self.host_target_combo = TargetCombo() self.host_mac_entry = gtk.Entry() self.host_ipv4_entry = gtk.Entry() self.host_ipv6_entry = gtk.Entry() #self.host_uptime_range = DateRange() #self.host_lastboot_range = DateRange() # Service self.serv_vbox = HIGVBox() self.serv_hbox = HIGHBox() self.serv_section = HIGSectionLabel(_("Service search parameters")) self.serv_table = HIGTable() self.serv_port_label = HIGEntryLabel(_("Port number")) self.serv_service_label = HIGEntryLabel(_("Service")) self.serv_product_label = HIGEntryLabel(_("Product")) self.serv_portstate_label = HIGEntryLabel(_("Port state")) self.serv_port_entry = gtk.Entry() self.serv_service_combo = ServiceCombo() self.serv_product_entry = gtk.Entry() self.serv_portstate_check = PortState() # OS self.os_vbox = HIGVBox() self.os_hbox = HIGHBox() self.os_section = HIGSectionLabel(_("Operating System search \ parameters")) self.os_table = HIGTable() self.os_osclass_label = HIGEntryLabel(_("OS class")) self.os_osmatch_label = HIGEntryLabel(_("OS match")) self.os_osclass_combo = OSClassCombo() self.os_osmatch_combo = OSMatchCombo() # Search options page self.opt_vbox = HIGVBox() self.opt_local_hbox = HIGHBox() self.opt_base_hbox = HIGHBox() self.opt_local_section = HIGSectionLabel(_("Local files")) self.opt_local_table = HIGTable() self.opt_base_section = HIGSectionLabel(_("Database")) self.opt_base_table = HIGTable() self.opt_path_label = HIGEntryLabel(_("Directory")) self.opt_extension_label = HIGEntryLabel(_("File extension")) self.opt_savetime_label = HIGEntryLabel(_("Save results for")) self.opt_path_entry = PathEntry() self.opt_extension_entry = gtk.Entry() self.opt_savetime_entry = SaveTime() self.opt_save_check = gtk.CheckButton(_("Save scan results in data \ base for latter search")) self.opt_search_check = gtk.CheckButton(_("Search saved scan results \ in data base"))
def _create_profile(self): self.profile_label = HIGEntryLabel(_('Profile:')) self.profile_entry = ProfileCombo() self.update()