import struct import binascii import binwalk.core.plugin class JFFS2ValidPlugin(binwalk.core.plugin.Plugin): ''' Helps validate JFFS2 signature results. The JFFS2 signature rules catch obvious cases, but inadvertently mark some valid JFFS2 nodes as invalid due to padding (0xFF's or 0x00's) in between nodes. ''' MODULES = ['Signature'] def _check_crc(self, node_header): # struct and binascii want a bytes object in Python3 node_header = binwalk.core.compat.str2bytes(node_header) # Get the header's reported CRC value if node_header[0:2] == b"\x19\x85": header_crc = struct.unpack(">I", node_header[8:12])[0] else: header_crc = struct.unpack("