(2009-10-7)使用shc加密shell脚本

(2009-10-7)使用shc加密shell脚本

SHC:generic shell script compiler 的缩写、简称,shc是一个专业的加密shell脚本的工具,它的作用是把shell脚本转换为一个可执行的二进制文件,这个办法很好的解决了脚本中含有IP、密码等不希望公开的问题. 就可以用shc来加密SHELL。

本文HTML永久地址 doc

安装

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum -y install shc 

用法

加密:

shc -r -f shell脚本
shc -v -f shell脚本

加完密码之后,会生成三个文件

 [root@localhost ~]# file changeyum.sh*
 changeyum.sh: Bourne-Again shell script text executable
 changeyum.sh.x: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped
 changeyum.sh.x.c: ASCII C program text

还可以设定有效期

 [root@localhost ~]# shc -e 04/02/2009 -m "Please contact [email protected]" -r -f changeyum.sh
 [root@localhost ~]# date
 2009年 04月 04日 星期六 17:37:40 CST
 [root@localhost ~]# ./changeyum.sh.x 过期了
 ./changeyum.sh.x: has expired!
 Please contact [email protected]

更多内容,请查看

shc --help

那个.c的文件,还可以用gcc编译

 gcc -o akin changeyum.sh.x.c
./akin

效果一样

没有评论 :

发表评论