Commit 1d4dbcb1 by devttys0

Fixed bug related to issue #83; additional signature sanity checks; removed…

Fixed bug related to issue #83; additional signature sanity checks; removed depreciated code from settings.py
parent 48d48d28
...@@ -174,6 +174,10 @@ class SignatureLine(object): ...@@ -174,6 +174,10 @@ class SignatureLine(object):
except ValueError as e: except ValueError as e:
raise ParserException("Failed to convert value '%s' to an integer on line '%s'" % (self.value, line)) raise ParserException("Failed to convert value '%s' to an integer on line '%s'" % (self.value, line))
# Sanity check to make sure the first line of a signature has an explicit value
if self.level == 0 and self.value is None:
raise ParserException("First element of a signature must specify a non-wildcard value: '%s'" % (line))
# Set the size and struct format value for the specified data type. # Set the size and struct format value for the specified data type.
# This must be done, obviously, after the value has been parsed out above. # This must be done, obviously, after the value has been parsed out above.
if self.type == 'string': if self.type == 'string':
......
...@@ -28,7 +28,6 @@ class Settings: ...@@ -28,7 +28,6 @@ class Settings:
# File names # File names
PLUGINS = "plugins" PLUGINS = "plugins"
EXTRACT_FILE = "extract.conf" EXTRACT_FILE = "extract.conf"
BINWALK_MAGIC_FILE = "binwalk"
BINARCH_MAGIC_FILE = "binarch" BINARCH_MAGIC_FILE = "binarch"
BINCAST_MAGIC_FILE = "bincast" BINCAST_MAGIC_FILE = "bincast"
...@@ -42,16 +41,14 @@ class Settings: ...@@ -42,16 +41,14 @@ class Settings:
self.system_dir = common.get_module_path() self.system_dir = common.get_module_path()
# Build the paths to all user-specific files # Build the paths to all user-specific files
self.user = common.GenericContainer(binwalk=self._user_path(self.BINWALK_MAGIC_DIR, self.BINWALK_MAGIC_FILE), self.user = common.GenericContainer(binarch=self._user_path(self.BINWALK_MAGIC_DIR, self.BINARCH_MAGIC_FILE),
binarch=self._user_path(self.BINWALK_MAGIC_DIR, self.BINARCH_MAGIC_FILE),
magic=self._magic_signature_files(user_only=True), magic=self._magic_signature_files(user_only=True),
extract=self._user_path(self.BINWALK_CONFIG_DIR, self.EXTRACT_FILE), extract=self._user_path(self.BINWALK_CONFIG_DIR, self.EXTRACT_FILE),
plugins=self._user_path(self.BINWALK_PLUGINS_DIR)) plugins=self._user_path(self.BINWALK_PLUGINS_DIR))
# Build the paths to all system-wide files # Build the paths to all system-wide files
self.system = common.GenericContainer(binwalk=self._system_path(self.BINWALK_MAGIC_DIR, self.BINWALK_MAGIC_FILE), self.system = common.GenericContainer(binarch=self._system_path(self.BINWALK_MAGIC_DIR, self.BINARCH_MAGIC_FILE),
binarch=self._system_path(self.BINWALK_MAGIC_DIR, self.BINARCH_MAGIC_FILE),
magic=self._magic_signature_files(system_only=True), magic=self._magic_signature_files(system_only=True),
extract=self._system_path(self.BINWALK_CONFIG_DIR, self.EXTRACT_FILE), extract=self._system_path(self.BINWALK_CONFIG_DIR, self.EXTRACT_FILE),
plugins=self._system_path(self.BINWALK_PLUGINS_DIR)) plugins=self._system_path(self.BINWALK_PLUGINS_DIR))
......
# This is just here to make sure that the older "binwalk" file in this directory
# is overwritten during an installation of the newer binwalk code.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment