def rar_v4(f):
# based on http://www.forensicswiki.org/wiki/RAR
# and http://acritum.com/winrar/rar-format
while True:
pos = f.tell()
crc, typ, flags, size = struct.unpack('<HBHH', f.read(7))
if flags & 0x8000:
size += struct.unpack('<L', f.read(4))[0]
if not 0x72 <= typ <= 0x7b:
raise FileCorrupted
f.try_seek(pos + size, os.SEEK_SET)
# f.try_seek(size, os.SEEK_CUR)
f.update_pos()
if typ == 0x7b:
break
elif typ == 0x73 and flags & 0x80:
return Ellipsis # encrypted, assume bad faith
return True
评论列表
文章目录