说明:
shc(generic shell script compiler)是一个专业的加密shell脚本的工具。它的作用是把shell脚本转换为一个可执行的二进制文件,这样可以很好地隐藏脚本中IP、密码、目录路径等敏感信息。
安装:
[root@linux ~]# yum -y install shc --nogpgcheck
使用:
[root@linux ~]# cd temp
[root@linux temp]# shc -v -r -T -f script-name
运行后会生成两个文件,script-name.x 和 script-name.x.c。其中script-name.x是加密后的可执行的二进制文件;用./script-name即可运行,script-name.x.c是生成 script-name.x的原文件(c语言)。
shc用法:
[root@linux ~]# shc -h
shc Version 3.8.6, Generic Script Compiler
shc Copyright (c) 1994-2006 Francisco Rosales
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
-e %s 设置过期日期,格式 dd/mm/yyyy format [none]
-m %s 过期时的提示信息
-f %s 待编译(即“加密”)的文件
-i %s Inline option for the shell interpreter i.e: -e
-x %s eXec command, as a printf format i.e: exec('%s',@ARGV);
-l %s Last shell option i.e: --
-r 制作一个可分发的二进制文件(可在相同 shc 版本的其它电脑上运行)
-v 显示编译的详细信息
-D Switch ON debug exec calls [OFF]
-T Allow binary to be traceable [no]
-C Display license and exit
-A Display abstract and exit
-h Display help and exit
Environment variables used:
Name Default Usage
CC cc C compiler command
CFLAGS C compiler flags
Please consult the shc(1) man page.
[root@linux ~]#
<完>