Commit 48d48d28 by devttys0

Added support for offset expressions

parent 58446a92
...@@ -418,7 +418,9 @@ class Magic(object): ...@@ -418,7 +418,9 @@ class Magic(object):
for period in [match.start() for match in self.period.finditer(expression)]: for period in [match.start() for match in self.period.finditer(expression)]:
# Separate the offset field into the integer offset and type values (o and t respsectively) # Separate the offset field into the integer offset and type values (o and t respsectively)
s = expression[:period].rfind('(') + 1 s = expression[:period].rfind('(') + 1
o = int(expression[s:period], 0) # The offset address may be an evaluatable expression, such as '(4+0.L)', typically the result
# of the original offset being something like '(&0.L)'.
o = binwalk.core.common.MathExpression(expression[s:period]).value
t = expression[period+1] t = expression[period+1]
# Re-build just the parsed offset portion of the expression # Re-build just the parsed offset portion of the expression
......
...@@ -576,8 +576,7 @@ ...@@ -576,8 +576,7 @@
>(198.L+202) belong 3 >(198.L+202) belong 3
>>&4 string @(RECENT_FIRMWARE)/ \b, alias: >>&4 string @(RECENT_FIRMWARE)/ \b, alias:
>>&23 string x "%s" >>&23 string x "%s"
#>>(&0.L(0)) belong x >>(&0.L+4) belong x \b, file size: %d bytes
#>>>&4 belong x \b, file size: %d bytes
# Signatures to identify the start of a VxWorks symbol table # Signatures to identify the start of a VxWorks symbol table
8 string \x00\x00\x05\x00\x00\x00\x00\x00 VxWorks symbol table, big endian, 8 string \x00\x00\x05\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
......
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