如何将 linux shell 脚本编译为独立的可执行文件 *binary*(即不仅仅是例如 chmod 755)? [英] How to compile a linux shell script to be a standalone executable *binary* (i.e. not just e.g. chmod 755)?

查看:24
本文介绍了如何将 linux shell 脚本编译为独立的可执行文件 *binary*(即不仅仅是例如 chmod 755)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个免费的开源工具集,它可以编译各种经典"脚本语言,例如Korn Shell、ksh、csh、bash 等作为可执行文件 -- 如果脚本调用其他程序或可执行文件,则将它们包含在单个可执行文件中.

I'm looking for a free open source tool-set that will compile various "classic" scripting languages, e.g. Korn Shell, ksh, csh, bash etc. as an executable -- and if the script calls other programs or executables, for them to be included in the single executable.

原因:

  1. 混淆交付给客户的代码,以免泄露我们的知识产权 - 交付到客户自己的机器/系统上,我无法控制我的权限可以设置有关访问权限,因此程序文件必须是二进制文件,因此无法通过在文本编辑器或 hexdump 查看器中查看来轻松查看工作情况.

  1. To obfuscate the code for delivery to a customer so as not to reveal our Intellectual Property - for delivery onto a customer's own machine/systems for which I have no control over what permissions I can set regarding access, so the program file has to be binary whereby the workings cannot be easily seen by viewing in a text editor or hexdump viewer.

为客户制作一个简单的单一部署程序,没有/或最少的任何外部依赖.

To make a single, simply deployed program for the customer without/or a minimal amount of any external dependencies.

我更喜欢不需要包管理器的简单东西,因为:

I would prefer something simple without the need for package manager since:

  1. 我不能依靠客户的知识来执行(取消)包装说明和

  1. I can't rely on the customer's knowledge to carry out (un) packaging instructions and

我不能依赖管理他们机器的关于安装软件包的政策(实际上来自第三方).

I can't rely on the policies governing their machines regarding installing packages (and indeed from third parties).

最简单的首选方法是能够将单个可执行文件编译为正确的机器代码,该可执行文件将在没有任何依赖的情况下开箱即用.

The simplest preferred approach is to be able to compile to proper machine code a single executable that will run out of the box without any dependencies.

推荐答案

完全满足我需求的解决方案是 SHC——一个免费工具,或者 CCsh 一个商业工具.两者都将 shell 脚本编译为 C,然后可以使用 C 编译器进行编译.

The solution that fully meets my needs would be SHC - a free tool, or CCsh a commercial tool. Both compile shell scripts to C, which then can be compiled using a C compiler.

关于 SHC 的链接:

Links about SHC:

关于 CCsh 的链接:

Links about CCsh:

这篇关于如何将 linux shell 脚本编译为独立的可执行文件 *binary*(即不仅仅是例如 chmod 755)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆