Beispiel #1
0
    def do_startup(self):
        """
        GTK calls this method after Gtk.Application.run()
        Creates instances of the sidebar, terminal, console log and
        statusbar to be added to the app window.
        Sets up necesary actions on menu and toolbar buttons
        Also reads the .xml file from menubar.xml
        """
        Gtk.Application.do_startup(self)  # deep GTK magic

        self.ws_sidebar = WorkspaceSidebar(self.workspace_manager,
                                           self.changeWorkspace,
                                           self.removeWorkspace,
                                           self.on_new_button,
                                           CONF.getLastWorkspace())

        self.updateHosts()
        self.hosts_sidebar = HostsSidebar(self.show_host_info, self.icons)
        default_model = self.hosts_sidebar.create_model(self.all_hosts)
        self.hosts_sidebar.create_view(default_model)

        self.sidebar = Sidebar(self.ws_sidebar.get_box(),
                               self.hosts_sidebar.get_box())

        host_count, service_count, vuln_count = self.update_counts()

        self.terminal = Terminal(CONF)
        self.console_log = ConsoleLog()
        self.statusbar = Statusbar(self.on_click_notifications,
                                   self.on_click_conflicts, host_count,
                                   service_count, vuln_count)

        self.notificationsModel = Gtk.ListStore(str)

        action = Gio.SimpleAction.new("about", None)
        action.connect("activate", self.on_about)
        self.add_action(action)

        action = Gio.SimpleAction.new("help", None)
        action.connect("activate", self.on_help)
        self.add_action(action)

        action = Gio.SimpleAction.new("quit", None)
        action.connect("activate", self.on_quit)
        self.add_action(action)

        action = Gio.SimpleAction.new("preferences", None)
        action.connect("activate", self.on_preferences)
        self.add_action(action)

        action = Gio.SimpleAction.new("pluginOptions", None)
        action.connect("activate", self.on_pluginOptions)
        self.add_action(action)

        action = Gio.SimpleAction.new("new", None)
        action.connect("activate", self.on_new_button)
        self.add_action(action)

        action = Gio.SimpleAction.new("new_terminal")  # new terminal = new tab
        action.connect("activate", self.on_new_terminal_button)
        self.add_action(action)

        action = Gio.SimpleAction.new("open_report")
        action.connect("activate", self.on_open_report_button)
        self.add_action(action)

        dirname = os.path.dirname(os.path.abspath(__file__))
        builder = Gtk.Builder.new_from_file(dirname + '/menubar.xml')
        builder.connect_signals(self)
        appmenu = builder.get_object('appmenu')
        self.set_app_menu(appmenu)
        helpMenu = builder.get_object('Help')
        self.set_menubar(helpMenu)
Beispiel #2
0
    def do_startup(self):
        """
        GTK calls this method after Gtk.Application.run()
        Creates instances of the sidebar, terminal, console log and
        statusbar to be added to the app window.
        Sets up necesary actions on menu and toolbar buttons
        Also reads the .xml file from menubar.xml
        """
        Gtk.Application.do_startup(self)  # deep GTK magic

        self.serverIO = ServerIO(CONF.getLastWorkspace())
        self.serverIO.continously_check_server_connection()

        self.ws_sidebar = WorkspaceSidebar(self.serverIO,
                                           self.change_workspace,
                                           self.remove_workspace,
                                           self.on_new_button,
                                           CONF.getLastWorkspace())

        # the dummy values here will be updated as soon as the ws is loaded.
        self.hosts_sidebar = HostsSidebar(self.show_host_info,
                                          self.serverIO.get_hosts,
                                          self.serverIO.get_host, self.icons)
        self.sidebar = Sidebar(self.ws_sidebar.get_box(),
                               self.hosts_sidebar.get_box())

        host_count, service_count, vuln_count = 0, 0, 0  # dummy values
        self.terminal = Terminal(CONF)
        self.console_log = ConsoleLog()
        self.statusbar = Statusbar(self.on_click_notifications,
                                   self.on_click_conflicts, host_count,
                                   service_count, vuln_count)

        self.notificationsModel = Gtk.ListStore(str)

        action_to_method = {
            "about": self.on_about,
            "quit": self.on_quit,
            "preferences": self.on_preferences,
            "pluginOptions": self.on_plugin_options,
            "faradayPlugin": self.on_faraday_plugin,
            "appstore": self.on_appstore,
            "new": self.on_new_button,
            "new_terminal": self.on_new_terminal_button,
            "open_report": self.on_open_report_button,
            "go_to_web_ui": self.on_click_go_to_web_ui_button,
            "go_to_documentation": self.on_help_dispatch,
            "go_to_faq": self.on_help_dispatch,
            "go_to_troubleshooting": self.on_help_dispatch,
            "go_to_demos": self.on_help_dispatch,
            "go_to_issues": self.on_help_dispatch,
            "go_to_forum": self.on_help_dispatch,
            "go_to_irc": self.on_help_dispatch,
            "go_to_twitter": self.on_help_dispatch,
            "go_to_googlegroup": self.on_help_dispatch
        }

        for action, method in action_to_method.items():
            gio_action = Gio.SimpleAction.new(action, None)
            gio_action.connect("activate", method)
            self.add_action(gio_action)

        dirname = os.path.dirname(os.path.abspath(__file__))
        builder = Gtk.Builder.new_from_file(dirname + '/menubar.xml')
        builder.connect_signals(self)
        appmenu = builder.get_object('appmenu')
        self.set_app_menu(appmenu)

        topmenu = Gio.Menu()
        pluginmenu = Gio.Menu()

        topmenu.append('Faraday Plugin...', 'app.faradayPlugin')

        plugins = fplugin_utils.get_available_plugins()

        for plugin in sorted(plugins.iterkeys()):
            gio_action = Gio.SimpleAction.new('fplugin_%s' % plugin, None)
            gio_action.connect("activate", self.type_faraday_plugin_command)
            self.add_action(gio_action)

            item = Gio.MenuItem.new(plugins[plugin]['prettyname'],
                                    'app.fplugin_%s' % plugin)

            pluginmenu.append_item(item)

        fmenu = Gio.Menu()

        fmenu.append_section(None, topmenu)
        fmenu.append_section(None, pluginmenu)

        appmenu.insert_submenu(1, "Faraday Plugin", fmenu)

        helpMenu = builder.get_object('Help')
        self.set_menubar(helpMenu)
Beispiel #3
0
    def do_startup(self):
        """
        GTK calls this method after Gtk.Application.run()
        Creates instances of the sidebar, terminal, console log and
        statusbar to be added to the app window.
        Sets up necesary actions on menu and toolbar buttons
        Also reads the .xml file from menubar.xml
        """
        Gtk.Application.do_startup(self)  # deep GTK magic

        self.serverIO = ServerIO(CONF.getLastWorkspace())
        self.serverIO.continously_check_server_connection()

        self.ws_sidebar = WorkspaceSidebar(self.serverIO,
                                           self.change_workspace,
                                           self.remove_workspace,
                                           self.on_new_button,
                                           CONF.getLastWorkspace())

        # the dummy values here will be updated as soon as the ws is loaded.
        self.hosts_sidebar = HostsSidebar(self.show_host_info, self.serverIO.get_hosts,
                                          self.icons)
        default_model = self.hosts_sidebar.create_model([]) # dummy empty list
        self.hosts_sidebar.create_view(default_model)
        self.sidebar = Sidebar(self.ws_sidebar.get_box(),
                               self.hosts_sidebar.get_box())

        host_count, service_count, vuln_count = 0, 0, 0  # dummy values
        self.terminal = Terminal(CONF)
        self.console_log = ConsoleLog()
        self.statusbar = Statusbar(self.on_click_notifications,
                                   self.on_click_conflicts,
                                   host_count, service_count, vuln_count)

        self.notificationsModel = Gtk.ListStore(str)

        action_to_method = {"about": self.on_about,
                            "quit": self.on_quit,
                            "preferences": self.on_preferences,
                            "pluginOptions": self.on_plugin_options,
                            "new": self.on_new_button,
                            "new_terminal": self.on_new_terminal_button,
                            "open_report": self.on_open_report_button,
                            "go_to_web_ui": self.on_click_go_to_web_ui_button,
                            "go_to_documentation": self.on_help_dispatch,
                            "go_to_faq": self.on_help_dispatch,
                            "go_to_troubleshooting": self.on_help_dispatch,
                            "go_to_demos": self.on_help_dispatch,
                            "go_to_issues": self.on_help_dispatch,
                            "go_to_forum": self.on_help_dispatch,
                            "go_to_irc": self.on_help_dispatch,
                            "go_to_twitter": self.on_help_dispatch,
                            "go_to_googlegroup": self.on_help_dispatch
                            }

        for action, method in action_to_method.items():
            gio_action = Gio.SimpleAction.new(action, None)
            gio_action.connect("activate", method)
            self.add_action(gio_action)

        dirname = os.path.dirname(os.path.abspath(__file__))
        builder = Gtk.Builder.new_from_file(dirname + '/menubar.xml')
        builder.connect_signals(self)
        appmenu = builder.get_object('appmenu')
        self.set_app_menu(appmenu)

        helpMenu = builder.get_object('Help')
        self.set_menubar(helpMenu)
Beispiel #4
0
    def do_startup(self):
        """
        GTK calls this method after Gtk.Application.run()
        Creates instances of the sidebar, terminal, console log and
        statusbar to be added to the app window.
        Sets up necesary actions on menu and toolbar buttons
        Also reads the .xml file from menubar.xml
        """
        Gtk.Application.do_startup(self)  # deep GTK magic

        self.ws_sidebar = WorkspaceSidebar(self.workspace_manager,
                                           self.change_workspace,
                                           self.remove_workspace,
                                           self.on_new_button,
                                           CONF.getLastWorkspace())

        # XXX: do not move next line, it is very important it stays there,
        # just after the creation of the sidebar and before updateHosts.
        # correct fix: move the creation of the ws_model to the application

        workspace_argument_set = self.open_workspace_from_args()
        if not workspace_argument_set:
            self.open_last_workspace()

        self.updateHosts()
        self.hosts_sidebar = HostsSidebar(self.show_host_info, self.icons)
        default_model = self.hosts_sidebar.create_model(self.all_hosts)
        self.hosts_sidebar.create_view(default_model)

        self.sidebar = Sidebar(self.ws_sidebar.get_box(),
                               self.hosts_sidebar.get_box())

        host_count, service_count, vuln_count = self.update_counts()

        self.terminal = Terminal(CONF)
        self.console_log = ConsoleLog()
        self.statusbar = Statusbar(self.on_click_notifications,
                                   self.on_click_conflicts, host_count,
                                   service_count, vuln_count)

        self.notificationsModel = Gtk.ListStore(str)

        action_to_method = {
            "about": self.on_about,
            "help": self.on_help,
            "quit": self.on_quit,
            "preferences": self.on_preferences,
            "pluginOptions": self.on_plugin_options,
            "new": self.on_new_button,
            "new_terminal": self.on_new_terminal_button,
            "open_report": self.on_open_report_button,
            "go_to_web_ui": self.on_click_go_to_web_ui_button
        }

        for action, method in action_to_method.items():
            gio_action = Gio.SimpleAction.new(action, None)
            gio_action.connect("activate", method)
            self.add_action(gio_action)

        dirname = os.path.dirname(os.path.abspath(__file__))
        builder = Gtk.Builder.new_from_file(dirname + '/menubar.xml')
        builder.connect_signals(self)
        appmenu = builder.get_object('appmenu')
        self.set_app_menu(appmenu)
        helpMenu = builder.get_object('Help')
        self.set_menubar(helpMenu)