猜测配置以使ZLIB压缩数据充气
我想充气ZLIB压缩数据。我在Python中尝试了以下内容:
zlib.decompress(data)
- >它返回以下错误:Zlib.Error:Decompressress数据时错误-3:数据检查不正确,
因此我找到了一种忽略数据检查的方法:
def decompress_corrupted(data):
d = zlib.decompressobj(zlib.MAX_WBITS | 32)
f = BytesIO(data)
result_str = b''
buffer = f.read(1)
try:
while buffer:
result_str += d.decompress(buffer)
buffer = f.read(1)
except zlib.error:
pass
return result_str
但是所产生的结果部分“损坏”:我得到了一个.rtf内容,而错误很少。
我的问题:由于我知道压缩使用Zlib算法,所以我可以尝试获取原始文档的配置零件(或预/后处理)?
上下文:用于压缩这些文件的解决方案不再是编辑的,编辑器从未回答我们的消息。我们只有一个编译的观众,但需要确切的算法才能迁移到替代解决方案。我们知道这些文件没有损坏,因为当前的查看器能够正确显示它们。
如果可以提供帮助:
- 这是数据的负责人:789C 95 54 5d 6f D3 30 14 ...
- 和尾巴:.. 79 AE C5 E2 E2 17 82 5E 3F 85
I want to inflate a zlib compressed data. I've tried the following in python:
zlib.decompress(data)
-> it return the following error: zlib.error: Error -3 while decompressing data: incorrect data check
So I found a way to ignore data check:
def decompress_corrupted(data):
d = zlib.decompressobj(zlib.MAX_WBITS | 32)
f = BytesIO(data)
result_str = b''
buffer = f.read(1)
try:
while buffer:
result_str += d.decompress(buffer)
buffer = f.read(1)
except zlib.error:
pass
return result_str
But the result produced is partially "corrupted": I get a .rtf content with few mistakes.
My question: since I know that the compression uses zlib algorithm, what are the configurations parts (or pre/post-processes) I could try to get the original document?
Context: the solution used to compress these files is no more edited and the editor has never answered our messages. We only possess a compiled viewer but need the exact algorithm to make a migration to alternative solution. We know these files are not corrupted since the current viewer is able to display them properly.
If it can help:
- here is the head of the data: 789C 95 54 5D 6F D3 30 14 ...
- and the tail: .. 79 AE C5 E2 17 82 5E 3F 85
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需“配置”。 Zlib的膨胀将使任何有效的压缩Zlib流无效地膨胀到原始内容。
因此,尽管您证明了您的数据,但您的数据在此过程中的某个地方正在损坏或故意修改。
There are no "configurations" needed. zlib's inflate will inflate any valid compressed zlib stream losslessly to the original content.
Therefore, despite your attestation, your data is getting corrupted or deliberately modified somewhere along the way.