diff --git a/src/binwalk/core/magic.py b/src/binwalk/core/magic.py index b507d78..e29671d 100644 --- a/src/binwalk/core/magic.py +++ b/src/binwalk/core/magic.py @@ -700,6 +700,16 @@ class Magic(object): return tags + def match(self, data): + ''' + Match the beginning of a data buffer to a signature. + + @data - The data buffer to match against the loaded signature list. + + Returns a list of SignatureResult objects. + ''' + return self.scan(data, 1) + def scan(self, data, dlen=None): ''' Scan a data block for matching signatures. @@ -732,7 +742,7 @@ 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: # 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 diff --git a/src/binwalk/magic/filesystems b/src/binwalk/magic/filesystems index 7c988d1..3da003a 100644 --- a/src/binwalk/magic/filesystems +++ b/src/binwalk/magic/filesystems @@ -123,7 +123,14 @@ >20 ubelong x data offset: 0x%X # http://lxr.free-electrons.com/source/fs/ubifs/ubifs-media.h -0 lelong 0x06101831 UBIFS superblock, +0 lelong 0x06101831 UBIFS master node, +>20 ubyte !7 {invalid} # Only look for the master node +>22 leshort !0 {invalid} +>24 lequad x highest inode: %d, +>32 lequad x commit number: %d + +# http://lxr.free-electrons.com/source/fs/ubifs/ubifs-media.h +0 lelong 0x06101831 UBIFS superblock node, >20 ubyte !6 {invalid} # Only look for the superblock node >4 ulelong x CRC: 0x%X, #>8 lequad x sqnum: %ld,