'Main cycle'

def sh(self, name='w3af', callback=None):

    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 as e:
                om.out.console(str(e))
        term.setRawInputMode(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:
            pass
        return 0
