以编程方式提取 .deb 包
我有 .deb 包,我需要以编程方式提取其内容。但是,我无法找到有关该主题的任何资源,例如 .deb
包格式规范,这将使我更多地了解如何在不对整个问题进行逆向工程的情况下解决问题。
有什么想法吗?
I have .deb
package whose contents I need to extract in a programmatic way. However, I am not able to find any resources on the topic, such as .deb
package format specification, which would give me some more idea how to approach the problem without going and reverse engineering the whole thing.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
实际上很简单。
要从 C 内部调用,您可以使用
system
:Quite simple, actually.
To call from within C, you could use
system
:如果您找不到这样的库(我也没有),并且无法诉诸运行系统命令,您始终可以实现自己的库来读取 ar 档案。 ar 文件格式并不是很复杂。
If you don't find a library for this (I didn't, either), and cannot resort to running system commands, you can always implement your own to read ar archives. The ar file format isn't terribly complicated.
.deb
包格式的设计目标之一是使用现有工具和/或库轻松提取。顶层结构确实是一个 ar 文件,但在其中,您会发现另一层结构,传统上是一对 tar 文件。有关更多文档,请参阅 http://en.wikipedia.org/wiki/Deb_(file_format)如果您找不到现有的库,您可能可以使用 GNU ar 源代码来构建自己的库,我希望有 ar / tar / cpio / 的通用库。你。
One of the design goals for the
.deb
package format was to make it easy to extract using existing tools and/or libraries. The top-level structure is indeed anar
file, but inside that, you will find another level of structure, which is traditionally a pair oftar
files. For more documentation, see e.g. http://en.wikipedia.org/wiki/Deb_(file_format)You can probably use the GNU
ar
sources to build a library of your own if you cannot find an existing library. I would expect there to be general libraries for ar / tar / cpio / what have you.我刚刚看到 libarchive 支持
ar
格式,以及大量其他人的。I just saw libarchive supports the
ar
format, along with a ton of others.