Beispiel #1
0
    def sh(self, name='w3af', callback=None):
        """
        Main cycle
        """
        try:
            if callback:
                if hasattr(self, '_context'):
                    ctx = self._context
                else:
                    ctx = None
                self._context = callbackMenu(
                    name, self, self._w3af, ctx, callback)
            else:
                self._context = rootMenu(name, self, self._w3af)

            self._lastWasArrow = False
            self._showPrompt()
            self._active = True
            term.setRawInputMode(True)

            self._executePending()

            while self._active:
                try:
                    c = term.getch()
                    self._handleKey(c)
                except Exception, e:
                    om.out.console(str(e))

            term.setRawInputMode(False)
Beispiel #2
0
    def sh(self, name='w3af', callback=None):
        """
        Main cycle
        """
        try:
            if callback:
                if hasattr(self, '_context'):
                    ctx = self._context
                else:
                    ctx = None
                self._context = callbackMenu(name, self, self._w3af, ctx,
                                             callback)
            else:
                self._context = rootMenu(name, self, self._w3af)

            self._lastWasArrow = False
            self._showPrompt()
            self._active = True
            term.set_raw_input_mode(True)

            self._executePending()

            while self._active:
                try:
                    c = term.getch()
                    self._handleKey(c)
                except Exception as e:
                    om.out.console(str(e))

            term.set_raw_input_mode(False)
        except KeyboardInterrupt:
            pass

        if not hasattr(self, '_parent'):
            try:
                self._w3af.quit()
                self._context.join()
                om.out.console(self._random_message())
                om.manager.process_all_messages()
            except KeyboardInterrupt:
                # The user might be in a hurry, and after "w3af>>> exit" he
                # might also press Ctrl+C like seen here:
                #     https://github.com/andresriancho/w3af/issues/148
                #
                # Since we don't want to show any tracebacks on this situation
                # just "pass".
                pass

            return 0