def start_scheduler(self): """ Do necessary checks before starting Scheduler. """ err = None if not amiroot(): # running as normal user alertdlg = GenericAlert(_("Scheduler Controller"), _("You are requesting to start Scheduler as a normal \ user.\n\nIn case some scheduled scan contains any \noptions that requires \ root previlegies they will end \nup not running.\n\nIf you don't want to \ start the Scheduler now, \nselect Cancel, if you want to run it as a normal \ user \nanyway, select OK, otherwise, select Help to learn \nhow you can \ start it as root."), buttons={1: (gtk.RESPONSE_HELP, gtk.STOCK_HELP), 2: (gtk.RESPONSE_CANCEL, gtk.STOCK_CANCEL), 3: (gtk.RESPONSE_OK, gtk.STOCK_OK)}) resp = alertdlg.run() if resp == gtk.RESPONSE_OK: err = self.schedcontrol.start(from_gui=True) elif resp == gtk.RESPONSE_HELP: show_help(self,"scheduler.html#starting-scheduler-as-root") alertdlg.destroy() else: # running as root err = self.schedcontrol.start(from_gui=True) if err: alertdlg = GenericAlert(_("Scheduler Controller"), _("The Scheduler couldn't be started, reason:\n\n") + str(err), buttons={1: (gtk.RESPONSE_HELP, gtk.STOCK_HELP), 2: (gtk.RESPONSE_OK, gtk.STOCK_OK)}) resp = alertdlg.run() if resp == gtk.RESPONSE_HELP: show_help(self,"scheduler.html#starting-scheduler") alertdlg.destroy()
def _disable_option(self, need_root): """ enable / disable option if non-root user. """ return not amiroot() and need_root
import sys import gtk from subprocess import Popen, PIPE from higwidgets.higwindows import HIGMainWindow from higwidgets.higboxes import HIGVBox from umit.core.Paths import Path from umit.core.Utils import amiroot from umit.gui.qs.EntryField import EntryField #from umit.core.qs import Nmap from umit.libkeybinder import libkeybinder root = amiroot() def unhide_callback(data=None): """ Handler called when key pressed to unhide quickscan """ data.deiconify() data.show_all() data.focus() class MainWindow(HIGMainWindow): """ """
import sys import gtk from subprocess import Popen, PIPE from higwidgets.higwindows import HIGMainWindow from higwidgets.higboxes import HIGVBox from umit.core.Paths import Path from umit.core.Utils import amiroot from umit.gui.qs.EntryField import EntryField #from umit.core.qs import Nmap from umit.libkeybinder import libkeybinder root = amiroot() def unhide_callback(data=None): """ Handler called when key pressed to unhide quickscan """ data.deiconify() data.show_all() data.focus() class MainWindow(HIGMainWindow): """ """ def __init__(self): HIGMainWindow.__init__(self)