예제 #1
0
def lzvn_decompress(compressed_stream, compressed_size, uncompressed_size): #TODO: Move to a class!
    '''Adds Prefix and Postfix bytes as required by decompressor, 
        then decompresses and returns uncompressed bytes buffer
    '''
    header = b'bvxn' + struct.pack('<I', uncompressed_size) + struct.pack('<I', compressed_size)
    footer = b'bvx$'
    return lzfse.decompress(header + compressed_stream + footer)
예제 #2
0
파일: img4.py 프로젝트: opyu190617/img4
                    print('    iv: ', restruct.format_value(kb['iv'], str))
                    print('    key:', restruct.format_value(kb['key'], str))
                    print()
            if p['compression']:
                print('  compression:')
                print('    algo:', p['compression']['algorithm'])
                print('    size:', p['compression']['original_size'])
                algo = p['compression']['algorithm']
            else:
                algo = None
            print()

        if args.outfile:
            if algo == 'lzfse':
                import lzfse
                data = lzfse.decompress(p['data'])
            elif algo:
                raise ValueError('unknown algorithm: {}'.format(algo))
            else:
                data = p['data']
            args.outfile.write(data)
    if manifest:
        m = manifest.native
        if args.raw:
            print(restruct.format_value(m, str))
        else:
            print('manifest:')
            for p in m['contents']:
                print('  body:')
                if p['type'] == 'MANB':
                    for c in p['categories']: