Commit b666c8fb by devttys0

Added CRC32 polynomial table signatures

parent 70df244e
......@@ -37,6 +37,7 @@ class SignatureResult(binwalk.core.module.Result):
self.strlen = 0
self.string = False
self.invalid = False
self.once = False
# These are set by code internally
self.id = 0
......@@ -374,6 +375,8 @@ class Magic(object):
self.data = ""
# A list of Signature class objects, populated by self.parse (see also: self.load)
self.signatures = []
# A set of signatures with the 'once' keyword that have already been displayed once
self.display_once = set()
self.show_invalid = invalid
self.includes = [re.compile(x) for x in include]
......@@ -509,7 +512,7 @@ class Magic(object):
tag_strlen = None
max_line_level = 0
previous_line_end = 0
tags = {'id' : signature.id, 'offset' : offset, 'invalid' : False}
tags = {'id' : signature.id, 'offset' : offset, 'invalid' : False, 'once' : False}
# Apply each line of the signature to self.data, starting at the specified offset
for n in range(0, len(signature.lines)):
......@@ -735,7 +738,16 @@ class Magic(object):
# Generate a SignatureResult object and append it to the results list if the
# signature is valid, or if invalid results were requested.
if not tags['invalid'] or self.show_invalid:
# Only display results with the 'once' tag once.
if tags['once']:
if signature.title in self.display_once:
continue
else:
self.display_once.add(signature.title)
# Append the result to the results list
results.append(SignatureResult(**tags))
# Add this offset to the matched_offsets set, so that it can be ignored by
# subsequent loops.
matched_offsets.add(offset)
......
# Base64 index tables
0 string ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= Standard base64 index table
0 string ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ Standard base64 index table
0 string ACEGIKMOQSUWYBDFHJLNPRTVXZacegikmoqsuwybdfhjlnprtvxz0246813579=+/ SerComm base64 index table
# CRC32 polynomial table
0 string \x00\x00\x00\x00\x77\x07\x30\x96\xEE\x0E\x61\x2C\x99\x09\x51\xBA CRC32 polynomial table, big endian
0 string \x00\x00\x00\x00\x96\x30\x07\x77\x2C\x61\x0E\xEE\xBA\x51\x09\x99 CRC32 polynomial table, little endian
......@@ -585,9 +585,9 @@
# 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,
>4 belong 0 {invalid}
>4 belong x first entry: [type: function, code address: 0x%X,
>4 ubelong x first entry: [type: function, code address: 0x%X,
>0 belong 0 {invalid}
>0 belong x symbol address: 0x%X]{display-once}
>0 ubelong x symbol address: 0x%X]{once}
>24 belong !0x500
>>24 belong !0x700
>>>24 belong !0x900 \b, {invalid}
......@@ -618,9 +618,9 @@
8 string \x00\x00\x07\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
>4 belong 0 {invalid}
>4 belong x first entry: [type: initialized data, code address: 0x%X,
>4 ubelong x first entry: [type: initialized data, code address: 0x%X,
>0 belong 0 {invalid}
>0 belong x symbol address: 0x%X]{display-once}
>0 ubelong x symbol address: 0x%X]{once}
>24 belong !0x500
>>24 belong !0x700
>>>24 belong !0x900 \b, {invalid}
......@@ -651,9 +651,9 @@
8 string \x00\x00\x09\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
>4 belong 0 {invalid}
>4 belong x first entry: [type: uninitialized data, code address: 0x%X,
>4 ubelong x first entry: [type: uninitialized data, code address: 0x%X,
>0 belong 0 {invalid}
>0 belong x symbol address: 0x%X]{display-once}
>0 ubelong x symbol address: 0x%X]{once}
>24 belong !0x500
>>24 belong !0x700
>>>24 belong !0x900 \b, {invalid}
......@@ -684,9 +684,9 @@
8 string \x00\x05\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong 0 {invalid}
>4 lelong x first entry: [type: function, code address: 0x%X,
>4 ulelong x first entry: [type: function, code address: 0x%X,
>0 lelong 0 {invalid}
>0 lelong x symbol address: 0x%X]{display-once}
>0 ulelong x symbol address: 0x%X]{once}
>24 lelong !0x500
>>24 lelong !0x700
>>>24 lelong !0x900 \b, {invalid}
......@@ -717,9 +717,9 @@
8 string \x00\x07\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong 0 {invalid}
>4 lelong x first entry: [type: initialized data, code address: 0x%X,
>4 ulelong x first entry: [type: initialized data, code address: 0x%X,
>0 lelong 0 {invalid}
>0 lelong x symbol address: 0x%X]{display-once}
>0 ulelong x symbol address: 0x%X]{once}
>24 lelong !0x500
>>24 lelong !0x700
>>>24 lelong !0x900 \b, {invalid}
......@@ -750,9 +750,9 @@
8 string \x00\x09\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong 0 {invalid}
>4 lelong x first entry: [type: uninitialized data, code address: 0x%X,
>4 ulelong x first entry: [type: uninitialized data, code address: 0x%X,
>0 lelong 0 {invalid}
>0 lelong x symbol address: 0x%X]{display-once}
>0 ulelong x symbol address: 0x%X]{once}
>24 lelong !0x500
>>24 lelong !0x700
>>>24 lelong !0x900 \b, {invalid}
......
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