采用shc工具加密Shell脚本

来源:互联网 发布:程序员直播赚钱 编辑:程序博客网 时间:2024/05/08 10:21
介绍:当我们写的shell脚本,存在有敏感信息如账号密码,于是想加强脚本的安全性;还有不想让别人查看/修改您的shell核心代码等等情况。都可使用以下工具进行加密。
shc是一个脚本编译工具, 使用RC4加密算法, 它能够把shell程序转换成二进制可执行文件(支持静态链接和动态链接)。
shc官网:http://www.datsi.fi.upm.es/~frosal/
安装shc
wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
tar vxf shc-3.8.7.tgz
cd shc-3.8.7
make test
make strings
make install
若报错:
***     Installing shc and shc.1 on /usr/local
***     ?Do you want to continue? y
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/
install: target `/usr/local/man/man1/' is not a directory: No such file or directory
make: *** [install] Error 1
请创建 mkdir -p /usr/local/man/man1/  ,然后运行make install
常用参数:
-e date (指定过期日期)
-m message (指定过期提示的信息)
-f script_name(指定要编译的shell的路径及文件名)
-r   Relax security. (可以相同操作系统的不同系统中执行)
-v   Verbose compilation(编译的详细情况)
使用方法:
shc -v -f abc.sh
-v 是现实加密过程
-f 后面跟需要加密的文件 
运行后会生成两个文件:
abc.sh.x 和 abc.sh.x.c
abc.sh.x为二进制文件,赋予执行权限后,可直接执行。更改名字mv abc.sh.x a.sh
abc.sh.x.c 是c源文件。基本没用,可以删除
另shc还提供了一种设定有效执行期
0 0
原创粉丝点击