shell脚本加密工具
2016-05-10 17:59
639 查看
1. 加密工具
1.1 gzexe
1.1.1 说明
gzexe是用来压缩执行文件的程序。当您去执行被压缩过的执行文件时,该文件会自动解压然后继续执行,和使用一般的执行文件相同。1.1.2 安装
Linux自带,不用单独安装。1.1.3 用法
gzexe filename.sh它会把原来没有加密的文件备份为 file.sh~ ,同时 file.sh 即被变成加密文件。
1.1.4 参数
-d 解开压缩文件1.2 shc
1.2.1 说明
shc是一个专业的加密shell脚本的工具,它的作用是把shell脚本转换为一个可执行的二进制文件,这个办法很好的解决了脚本中含有IP、密码等不希望公开的问题。1.2.2 安装
方法一:编译安装tar zxvf shc-3.8.tgz
cd shc-3.8
make test
make
make test
make strings
make install
方法二 :rpm包安装
安装包下载:http://pkgs.repoforge.org/shc/
yum install shc-3.8.6-1.el6.rf.x86_64.rpm
1.2.3 用法
shc -r -f script-name运行后会生成两个文件,script-name.x 和 script-name.x.c。其中script-name.x是加密后的可执行的二进制文件;用./script-name.x即可运行,script-name.x.c是生成 script-name.x的原文件(c语言)。
1.2.4 参数
-e dateExpiration date in dd/mm/yyyyformat [none](指定过期日期)
-m message
Message to display uponexpiration ["Please contact your provider"](指定过期提示的信息)
-f script_name
File name of the script tocompile(指定要编译的shell的路径及文件名)
-r Relax security.
Make a redistributable binarywhich executes on different systems running the same operat-ing system.(可以相同操作系统的不同系统中执行)
-v Verbose compilation(编译的详细情况)
示例:
[root@centos54 tmp]#shc -e20/10/2010 -m "contact xxx@163.com" -v -r -f ./ex.sh
-e:指定过期时间为2010年10月20日
-m:过期后打印出的信息;
-v: verbose
-r: 可在相同操作系统的不同主机上执行
-f: 指定源shell
2. 安装遇到的问题
2.1 编译安装的问题
[root@mysqltest shc-3.8.7]# make testcc -Wall -O6 shc.c -o shc
*** Compiling script "match"
CFLAGS="-Wall -O6 " ./shc -v -f match
shc shll=sh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc -Wall -O6 match.x.c -o match.x
shc: strip match.x
shc: chmod go-r match.x
*** Running a compiled test script!
*** It must show files with substring "sh" in your PATH...
./match.x sh
到./match.x sh后卡住不动,该问题为环境问题, 可以换个干净的系统测试。
2.2 yum安装后shc加密的问题
仍然是上个环境问题,yum安装后加密,遇到提示:[root@mysqltest wangpan]# shc-r -f echo.sh
echo.sh.x.c: In function'chkenv':
echo.sh.x.c:212: warning: castfrom pointer to integer of different size
如果直接运行./echo.sh.x,则会提示:
[root@mysqltest wangpan]# ./echo.sh.x
[1]+ Stopped ./echo.sh.x
该问题仍然是环境问题导致的,还是要换个干净系统。
2.3 间接解决方法
找一个环境没有问题的系统加密后拷贝到正式系统运行。2.4 在以上问题中如果您有更好的解决方法,请回复我,共同学习,谢谢!
相关文章推荐
- 生成树状结构的脚本bat\python\shell
- shell新增用户
- spark shell编程基础知识
- Shell数组例子
- shell脚本显示颜色的设置
- linux基础之shell编程(4)-for循环和case语句
- shell浅谈之一变量和引用
- c bash 代码遍历文件夹下所有文件
- shell变量
- shell if语句
- Xshell 连接 Ubuntu虚拟机
- Bash循环与分支浅谈
- 用PHP执行shell命令
- Shell脚本 curl获取必应每日壁纸(Mac OS)
- Shell之实现多线程
- 常用shell命令
- shell 生成数组
- shell教程-002:常见的Shell种类
- shell教程-001:shell简介 什么是shell,shell命令的两种执行方式
- Bash 的 shopt extglob ( 用来删除指定文件以外的文件,反向删除)