Commit 9e0a0c1f by devttys0

Re-implemented support for adjust signature keyword

parent 3c87c3b7
...@@ -34,6 +34,7 @@ class SignatureResult(object): ...@@ -34,6 +34,7 @@ class SignatureResult(object):
self.size = 0 self.size = 0
self.name = None self.name = None
self.offset = 0 self.offset = 0
self.adjust = 0
self.strlen = 0 self.strlen = 0
self.string = False self.string = False
self.invalid = False self.invalid = False
......
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
>(7.b+40) string x boot partition: "%s" >(7.b+40) string x boot partition: "%s"
# TP-Link firmware header structure; thanks to Jonathan McGowan for reversing and documenting this format # TP-Link firmware header structure; thanks to Jonathan McGowan for reversing and documenting this format
0 string TP-LINK\x20Technologies TP-Link firmware header,{offset-adjust:-4} 4 string TP-LINK\x20Technologies TP-Link firmware header,
#>-4 lelong x header version: %d, #>-4 lelong x header version: %d,
>0x94 beshort x firmware version: %d. >0x94 beshort x firmware version: %d.
>0x96 beshort x \b%d. >0x96 beshort x \b%d.
...@@ -404,15 +404,14 @@ ...@@ -404,15 +404,14 @@
>4 byte 0 {invalid}, >4 byte 0 {invalid},
>4 string x version: "%s" >4 string x version: "%s"
0 string \x00\x00\x00\x00PART Ubiquiti partition header,{offset-adjust:4} 4 string \x00\x00\x00\x00PART Ubiquiti partition header,
>0 byte x header size: 56 bytes, >0 byte x header size: 56 bytes,
>8 byte 0 {invalid} >8 byte 0 {invalid}
>8 string x name: "%s", >8 string x name: "%s",
>44 belong x base address: 0x%.8X, >44 belong x base address: 0x%.8X,
>52 belong x data size: %d bytes >52 belong x data size: %d bytes{size:%d}
>52 belong x {file-size:%d}
0 string \x00\x00\x00\x00END\x2e Ubiquiti end header, header size: 12 bytes,{offset-adjust:4} 4 string \x00\x00\x00\x00END\x2e Ubiquiti end header, header size: 12 bytes,
>12 belong !0 {invalid}, >12 belong !0 {invalid},
>8 belong x cumulative ~CRC32: 0x%.8X >8 belong x cumulative ~CRC32: 0x%.8X
...@@ -483,7 +482,7 @@ ...@@ -483,7 +482,7 @@
>19 string AES-256\n \b, encrypted AES-256 >19 string AES-256\n \b, encrypted AES-256
# http://forum.xda-developers.com/showthread.php?p=47818657 # http://forum.xda-developers.com/showthread.php?p=47818657
0 string imgARMcC Roku aimage SB{offset-adjust:-8} 8 string imgARMcC Roku aimage SB
# Boot ROM images for Sun/Cobalt Linux server appliances # Boot ROM images for Sun/Cobalt Linux server appliances
0 string Cobalt\ Networks\ Inc.\nFirmware\ v Paged Sun/COBALT boot rom, 0 string Cobalt\ Networks\ Inc.\nFirmware\ v Paged Sun/COBALT boot rom,
......
...@@ -152,10 +152,11 @@ class Signature(Module): ...@@ -152,10 +152,11 @@ class Signature(Module):
continue continue
# Keep a record of the relative offset of this signature inside the current data block # Keep a record of the relative offset of this signature inside the current data block
relative_offset = r.offset # (used later for setting current_block_offset).
relative_offset = r.offset + r.adjust
# Set the absolute offset inside the target file # Set the absolute offset inside the target file
r.offset = block_start + r.offset r.offset = block_start + relative_offset
# Provide an instance of the current file object # Provide an instance of the current file object
r.file = fp r.file = fp
......
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