Пример #1
0
def main(argv=None):
    # New user interactive session (with extra bells and whistles).
    user_session = session.InteractiveSession()
    user_session.session_list.append(user_session)
    text_renderer = text.TextRenderer(session=user_session)

    with text_renderer.start():
        plugin_cls, flags = args.parse_args(argv=argv,
                                            user_session=user_session)

        # Determine if an external script needs to be run first.
        if getattr(flags, "run", None):
            # Export the session object to the external script.
            user_session.locals["session"] = user_session
            exec open(flags.run) in user_session.locals

    try:
        # Run the plugin with plugin specific args.
        user_session.RunPlugin(plugin_cls, **config.RemoveGlobalOptions(flags))
    except Exception as e:
        logging.fatal("%s. Try --debug for more information." % e)
        if getattr(flags, "debug", None):
            pdb.post_mortem(sys.exc_info()[2])
        raise
    finally:
        user_session.Flush()
Пример #2
0
def main(argv=None):
    # New user interactive session (with extra bells and whistles).
    user_session = session.InteractiveSession()
    user_session.session_list.append(user_session)

    # Alow all special plugins to run.
    user_session.privileged = True

    def global_arg_cb(global_flags, _):
        if global_flags.version:
            print("This is Rekall Version %s (%s)" % (
                constants.VERSION, constants.CODENAME))

            print(rekall.get_versions())
            sys.exit(0)

    with user_session.GetRenderer().start():
        plugin_cls, flags = args.parse_args(
            argv=argv, global_arg_cb=global_arg_cb,
            user_session=user_session)

    # Install any quotas the user requested.
    user_session = quotas.wrap_session(user_session)
    try:
        # Run the plugin with plugin specific args.
        user_session.RunPlugin(plugin_cls, **config.RemoveGlobalOptions(flags))
    except Exception as e:
        logging.fatal("%s. Try --debug for more information." % e)
        if getattr(flags, "debug", None):
            pdb.post_mortem(sys.exc_info()[2])
        raise
    finally:
        user_session.Flush()
Пример #3
0
def main(argv=None):
    # New user interactive session (with extra bells and whistles).
    user_session = session.InteractiveSession()
    user_session.session_list.append(user_session)
    text_renderer = text.TextRenderer(session=user_session)

    with text_renderer.start():
        plugin_cls, flags = args.parse_args(argv=argv,
                                            user_session=user_session)

        # Determine if an external script needs to be run first.
        if getattr(flags, "run", None):
            # Export the session object to the external script.
            user_session.locals["session"] = user_session
            exec open(flags.run) in user_session.locals

    try:
        # Run the plugin with plugin specific args.
        user_session.RunPlugin(plugin_cls, **config.RemoveGlobalOptions(flags))
    except Exception as e:
        if getattr(flags, "debug", None):
            pdb.post_mortem(sys.exc_info()[2])
        else:
            logging.error("%s. Try --debug for more information." % e)

        # Exit with an error.
        sys.exit(-1)

    # Right before we exit we check if we need to save the current session.
    if user_session.state.session_filename and (
            user_session.state.dirty or user_session.state.cache.dirty):
        user_session.SaveToFile(user_session.state.session_filename)