Example #1
0
def init(platform, root_path, volatility_path, conf_name):
    try:
        # Just configure basic logging
        import logging
        logging.basicConfig()
        # Initialize stuff
        pp_debug("[*] Platform: %s\n" % platform)
        pp_debug("[*] Starting python module initialization\n")
        pp_debug("[*] Reading configuration from '%s'\n" % (conf_name))
        sys.settrace
        config = ConfigParser.RawConfigParser()
        # Store configuration information in raw,
        # for plugins to be able to fetch it
        conf_m.config = config
        if not os.path.isfile(conf_name):
            pp_error("[!] Could not initialize pyrebox, conf file '%s' missing!\n" % (conf_name))
            return None
        config.read(conf_name)
        vol_profile = config.get('VOL', 'profile')
        # Set global configuration
        conf_m.volatility_path = volatility_path
        conf_m.vol_profile = vol_profile
        conf_m.platform = platform
        conf_m.pyre_root = root_path

        if platform == "x86_64-softmmu":
            conf_m.bitness = 64
            conf_m.endianess = "l" 
        elif platform == "i386-softmmu":
            conf_m.bitness = 32
            conf_m.endianess = "l" 

        sys.path.append(volatility_path)
        sys.path.append(root_path)
        sys.path.append(os.getcwd())
        if not init_volatility():
            return None

        # Initialize the shell now
        from ipython_shell import initialize_shell
        initialize_shell()

        # Initialize the symbol cache from the file
        if config.has_option('SYMBOL_CACHE', 'path'):
            from vmi import load_symbols_from_cache_file
            from vmi import set_symbol_cache_path
            set_symbol_cache_path(config.get('SYMBOL_CACHE', 'path'))
            load_symbols_from_cache_file()

        return vol_profile
    except Exception as e:
        # Do this to make sure we print the stack trace to help trouble-shooting
        traceback.print_exc()
        raise e
Example #2
0
def init(platform, root_path, volatility_path):
    global conf
    try:
        # Just configure basic logging
        import logging
        logging.basicConfig()
        # Initialize stuff
        pp_debug("[*] Platform: %s\n" % platform)
        pp_debug("[*] Starting python module initialization\n")
        pp_debug("[*] Reading configuration\n")
        sys.settrace
        config = ConfigParser.RawConfigParser()
        if not os.path.isfile("pyrebox.conf"):
            pp_error(
                "[!] Could not initialize pyrebox, pyrebox.conf file missing!\n"
            )
            return None
        config.read('pyrebox.conf')
        vol_profile = config.get('VOL', 'profile')
        conf = ConfigManager(volatility_path=volatility_path,
                             vol_profile=vol_profile,
                             platform=platform)
        sys.path.append(conf.volatility_path)
        sys.path.append(root_path)
        sys.path.append(os.getcwd())
        # Set global configuration
        conf_m.conf = conf
        if not init_volatility(conf_m.conf):
            return None

        # Initialize the shell now
        from ipython_shell import initialize_shell
        initialize_shell()

        # Locate python modules that should be loaded by default
        for (module, enable) in config.items("MODULES"):
            if enable.strip().lower() == "true" or enable.strip().lower(
            ) == "yes":
                import_module(module)

        pp_debug("[*] Finished python module initialization\n")
        return vol_profile
    except Exception as e:
        # Do this to make sure we print the stack trace to help trouble-shooting
        traceback.print_exc()
        raise e
Example #3
0
def init(platform, root_path, volatility_path, conf_name):
    try:
        # Just configure basic logging
        import logging
        logging.basicConfig()
        # Initialize stuff
        pp_debug("[*] Platform: %s\n" % platform)
        pp_debug("[*] Starting python module initialization\n")
        pp_debug("[*] Reading configuration from '%s'\n" % (conf_name))
        sys.settrace
        config = ConfigParser.RawConfigParser()
        # Store configuration information in raw,
        # for plugins to be able to fetch it
        conf_m.config = config
        if not os.path.isfile(conf_name):
            pp_error(
                "[!] Could not initialize pyrebox, conf file '%s' missing!\n" %
                (conf_name))
            return None
        config.read(conf_name)
        vol_profile = config.get('VOL', 'profile')
        # Set global configuration
        conf_m.volatility_path = volatility_path
        conf_m.vol_profile = vol_profile
        conf_m.platform = platform
        conf_m.pyre_root = root_path
        sys.path.append(volatility_path)
        sys.path.append(root_path)
        sys.path.append(os.getcwd())
        if not init_volatility():
            return None

        # Initialize the shell now
        from ipython_shell import initialize_shell
        initialize_shell()

        return vol_profile
    except Exception as e:
        # Do this to make sure we print the stack trace to help trouble-shooting
        traceback.print_exc()
        raise e
Example #4
0
def init(platform, root_path, volatility_path, conf_name):
    try:
        # Just configure basic logging
        import logging
        logging.basicConfig()
        # Initialize stuff
        pp_debug("[*] Platform: %s\n" % platform)
        pp_debug("[*] Starting python module initialization\n")
        pp_debug("[*] Reading configuration from '%s'\n" % (conf_name))
        sys.settrace
        config = ConfigParser.RawConfigParser()
        # Store configuration information in raw,
        # for plugins to be able to fetch it
        conf_m.config = config
        if not os.path.isfile(conf_name):
            pp_error("[!] Could not initialize pyrebox, conf file '%s' missing!\n" % (conf_name))
            return None
        config.read(conf_name)
        vol_profile = config.get('VOL', 'profile')
        # Set global configuration
        conf_m.volatility_path = volatility_path
        conf_m.vol_profile = vol_profile
        conf_m.platform = platform
        sys.path.append(volatility_path)
        sys.path.append(root_path)
        sys.path.append(os.getcwd())
        if not init_volatility():
            return None

        # Initialize the shell now
        from ipython_shell import initialize_shell
        initialize_shell()

        return vol_profile
    except Exception as e:
        # Do this to make sure we print the stack trace to help trouble-shooting
        traceback.print_exc()
        raise e