Ejemplo n.º 1
0
    def command(self):
        session, config = self.session, self.session.config

        session.interactive = True
        if sys.stdout.isatty() and sys.platform[:3] != "win":
            session.ui.term = ANSIColors()

        # Create and start the rest of the threads, load the index.
        if config.loaded_config:
            Load(session, '').run(quiet=True)
        else:
            config.prepare_workers(session, daemons=True)

        # Note: We do *not* update the MOTD on startup, to keep things
        #       fast, and to avoid leaking our IP on setup, before Tor
        #       has been configured.
        splash = HelpSplash(session, 'help', []).run()
        motd = MessageOfTheDay(session, 'motd', ['--noupdate']).run()
        session.ui.display_result(splash)
        print  # FIXME: This is a hack!
        session.ui.display_result(motd)

        Interact(session)

        return self._success(_('Ran interactive shell'))
Ejemplo n.º 2
0
    def command(self):
        session, config = self.session, self.session.config

        session.interactive = True
        if sys.stdout.isatty() and sys.platform != "win32":
            session.ui.term = ANSIColors()

        # Create and start the rest of the threads, load the index.
        if config.loaded_config:
            Load(session, '').run(quiet=True)
        else:
            config.prepare_workers(session, daemons=True)

        session.ui.display_result(HelpSplash(session, 'help', []).run())
        Interact(session)

        return self._success(_('Ran interactive shell'))
Ejemplo n.º 3
0
        try:
            shorta = ''.join([k for k in COMMANDS.keys() if not k[0] == '_'])
            longa = [v[0] for v in COMMANDS.values()]
            opts, args = getopt.getopt(args, shorta, longa)
            for opt, arg in opts:
                Action(session, opt.replace('-', ''), arg)
            if args:
                Action(session, args[0], ' '.join(args[1:]))

        except (getopt.GetoptError, UsageError), e:
            session.error(e)

        if not opts and not args:
            # Create and start the rest of the threads, load the index.
            config.prepare_workers(session, daemons=True)
            Load(session, '').run(quiet=True)
            session.ui.display_result(Help(session, 'Help', ['splash']).run())
            session.interactive = session.ui.interactive = True
            Interact(session)

    except KeyboardInterrupt:
        pass

    finally:
        mailpile.util.QUITTING = True
        config.stop_workers()


if __name__ == "__main__":
    Main(sys.argv[1:])