Handle FAT filesystem with fsimage comparator

Signed-off-by: Marek Marczykowski-Górecki's avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
parent b90bd2f6
......@@ -77,10 +77,23 @@ class FsImageContainer(Archive):
class FsImageFile(File):
DESCRIPTION = "ext2/ext3/ext4/btrfs filesystems"
DESCRIPTION = "ext2/ext3/ext4/btrfs/fat filesystems"
CONTAINER_CLASS = FsImageContainer
FILE_TYPE_RE = re.compile(r'^(Linux.*filesystem data|BTRFS Filesystem).*')
@classmethod
def recognizes(cls, file):
# Avoid DOS / MBR file type as it generate a lot of false possitives,
# manually check "System identifier string" instead
with open(file.path, 'rb') as f:
f.seek(54)
if f.read(8) in (b'FAT12 ', b'FAT16 '):
return True
f.seek(82)
if f.read(8) == b'FAT32 ':
return True
return super().recognizes(file)
def compare_details(self, other, source=None):
differences = []
my_fs = ''
......
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