Commit 7d7a10ba by devttys0

Added back trx validation checks

parent 49fd6ad4
......@@ -754,9 +754,11 @@ class Magic(object):
# If this offset has already been matched to a previous signature, ignore it unless
# self.show_invalid has been specified. Also ignore obviously invalid offsets (<1)
# as well as those outside the specified self.data range (dlen).
if (offset not in matched_offsets or self.show_invalid) and offset >= 0 and offset < dlen:
#if (offset not in matched_offsets or self.show_invalid) and offset >= 0 and offset < dlen:
if offset >= 0 and offset < dlen:
# Analyze the data at this offset using the current signature rule
tags = self._analyze(signature, offset)
# 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) and not self._filtered(tags['description']):
......
......@@ -89,34 +89,22 @@
>48 string x root device: "%s"
# trx image file
0 string HDR0 TRX firmware header, little endian, header size: 28 bytes,
>4 ulelong x image size: %d bytes,
>8 ulelong x CRC32: 0x%X
>12 uleshort x flags: 0x%X,
>14 uleshort 1 version: %d,
>>16 ulelong x loader offset: 0x%X,
>>20 ulelong x linux kernel offset: 0x%X,
>>24 ulelong x rootfs offset: 0x%X
>>24 ulelong 0 {invalid}
0 string HDR0 TRX firmware header, little endian, header size: 28 bytes,
>4 ulelong x image size: %d bytes,
>8 ulelong x CRC32: 0x%X
>12 uleshort x flags: 0x%X,
>14 uleshort 1 version: %d,
>>16 ulelong x kernel offset: 0x%X,
>>20 ulelong x rootfs offset: 0x%X
>>24 ulelong !0 {invalid}
0 string HDR0 TRX firmware header, little endian, header size: 32 bytes,
>4 lelong <1 {invalid}
>4 ulelong x image size: %d bytes,
>8 ulelong x CRC32: 0x%X
>12 uleshort x flags: 0x%X,
>14 uleshort !1
>>14 uleshort !2 {invalid}
>14 uleshort 2 version: %d,
>>16 ulelong x loader offset: 0x%X,
>>20 ulelong x linux kernel offset: 0x%X,
>>24 ulelong x rootfs offset: 0x%X,
>>28 ulelong x bin-header offset: 0x%X
>14 uleshort 1 version: %d,
>>16 ulelong x kernel offset: 0x%X,
>>20 ulelong x rootfs offset: 0x%X
>>24 ulelong !0 {invalid}
# Ubicom firmware image
0 belong 0xFA320080 Ubicom firmware header,
......
......@@ -85,7 +85,6 @@ class Signature(Module):
# Create a signature from the raw bytes, if any
if self.raw_bytes:
print (self.raw_bytes)
raw_signatures = []
for raw_bytes in self.raw_bytes:
raw_signatures.append("0 string %s %s" % (raw_bytes, raw_bytes))
......@@ -139,7 +138,6 @@ class Signature(Module):
# Scan this data block for magic signatures
for r in self.magic.scan(data, dlen):
# current_block_offset is set when a jump-to-offset keyword is encountered while
# processing signatures. This points to an offset inside the current data block
# that scanning should jump to, so ignore any subsequent candidate signatures that
......
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