diff --git a/volatility/cli/__init__.py b/volatility/cli/__init__.py index 61cb581cb..e64db7ba9 100644 --- a/volatility/cli/__init__.py +++ b/volatility/cli/__init__.py @@ -4,7 +4,7 @@ import sys import volatility.framework import volatility.plugins -from volatility.framework import automagic, contexts, interfaces +from volatility.framework import automagic, constants, contexts, interfaces from volatility.framework.renderers.text import TextRenderer __author__ = 'mike' @@ -27,10 +27,9 @@ class CommandLine(object): pass def run(self): - ver = volatility.framework.version() - sys.stdout.write("Volatility Framework 3 (version " + "{0}.{1}.{2}".format(ver[0], ver[1], ver[2]) + ")\n") + sys.stdout.write("Volatility Framework {}\n".format(constants.PACKAGE_VERSION)) - volatility.framework.require_version(0, 0, 0) + volatility.framework.require_interface_version(0, 0, 0) # TODO: Get CLI config options volatility.framework.import_files(volatility.plugins) diff --git a/volatility/framework/__init__.py b/volatility/framework/__init__.py index d94c0f5b8..5c9267310 100644 --- a/volatility/framework/__init__.py +++ b/volatility/framework/__init__.py @@ -26,22 +26,24 @@ AGE = 0 # Number of consecutive versions of the interface the current version s vollog = logging.getLogger("volatility") -def version(): +def interface_version(): """Provides the so version number of the library""" return CURRENT - AGE, AGE, REVISION -def require_version(*args): +def require_interface_version(*args): """Checks the required version of a plugin""" if len(args): - if args[0] != version()[0]: + if args[0] != interface_version()[0]: raise RuntimeError( - "Framework version {} is incompatible with required version {}".format(version()[0], args[0])) + "Framework interface version {} is incompatible with required version {}".format(interface_version()[0], + args[0])) if len(args) > 1: - if args[1] > version()[1]: - raise RuntimeError("Framework version {} is an older revision than the required version {}".format( - ".".join([str(x) for x in version()[0:1]]), - ".".join([str(x) for x in args[0:2]]))) + if args[1] > interface_version()[1]: + raise RuntimeError( + "Framework interface version {} is an older revision than the required version {}".format( + ".".join([str(x) for x in interface_version()[0:1]]), + ".".join([str(x) for x in args[0:2]]))) def class_subclasses(cls): diff --git a/volatility/framework/constants.py b/volatility/framework/constants.py index 1656c225d..a0fc04b42 100644 --- a/volatility/framework/constants.py +++ b/volatility/framework/constants.py @@ -7,3 +7,4 @@ import os.path PLUGINS_PATH = [os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "plugins"))] BANG = "!" +PACKAGE_VERSION = "3.0.0_alpha1" diff --git a/volatility/framework/symbols/intermed.py b/volatility/framework/symbols/intermed.py index 964643b44..9ec56f291 100644 --- a/volatility/framework/symbols/intermed.py +++ b/volatility/framework/symbols/intermed.py @@ -3,7 +3,7 @@ import json import logging import urllib.parse -from volatility.framework import constants, exceptions, interfaces, objects, class_subclasses +from volatility.framework import class_subclasses, constants, exceptions, interfaces, objects vollog = logging.getLogger(__name__) @@ -34,7 +34,8 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface): supported, age, revision = [int(x) for x in version.split(".")] supported_versions = [x for x in versions.keys() if x[0] == supported and x[1] >= age] if not supported_versions: - raise ValueError("No Intermediate Format versions support file version: {}".format(version)) + raise ValueError( + "No Intermediate Format interface versions support file interface version: {}".format(version)) return versions[max(supported_versions)] def _construct_delegate_function(name, is_property = False):