运行与数据连接的可执行文件?
这有点令人困惑。我有一个 Linux 可执行文件,但没有用于查看某种类型的专有数据的源代码。
我想要一份可以打开并查看一个特定文件的可执行文件的副本。通常,我只需编写一个脚本,使用正确的参数启动可执行文件,但问题是我需要将功能作为单个文件提供。我无法将可执行文件和数据文件分开。
我认为做到这一点的唯一方法是将数据文件与可执行文件连接起来,以及一个小的自编写的可执行文件来实现这个魔法。这样做的问题是我不知道如何编写神奇的可执行文件,或者我的建议是否可行。
This is a bit confusing. I have a linux executable that I do not have the source code for that is used to view a certain type of proprietary data.
I'd like to have a copy of the executable that opens viewing one particular file. Normally I'd just write a script that launches the executable with the right arguments, but the trouble is that I need to deliver the functionality as a single file. I can't have the executable and the data file separate.
The only way I see to do this is to concatenate the data file with the executable, along with a small self-written executable to do the magic. The trouble with this is that I have no idea how to write the magic executable, or if what I propose is even possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一些 Linux 安装程序作为 shell 脚本分发,其工作方式如下:
脚本本身是可执行的,并且包含所有关联的二进制文件、数据文件等。作为此处文档,可能首先base64 编码。当脚本运行时,它会提取组件,然后根据需要执行或安装它们。
这样的计划对您有用吗?
Some linux installers are distributed as shell scripts that work something like this:
The script itself is executable, and it contains all of its associated binaries, data files, etc. as here documents, probably first base64 encoded. When the script runs, it extracts the components, then executes or installs them as appropriate.
Will a scheme like this work for you?
您可以使用数据(程序的二进制表示形式)编写程序,然后运行应用程序保存应用程序、数据并执行应用程序...等待应用程序终止,然后清理应用程序和应用程序。数据。
保存数据&程序作为 C 字符串...您可能可以编写一个脚本来生成一次定义一个字节的 char 数组的代码。
You could write a program with the data, a binary representation of the program, and running the app saves the app, data and executes the app... waits for app to terminate, then cleans up app & data.
Save the data & program as C-strings... you can probably write a script to generate code that defines a char array one byte at a time.