linux脚本在线加密,shell脚本加密工具

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包安装

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 date

Expiration 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 test

cc -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 在以上问题中如果您有更好的解决方法,请回复我,共同学习,谢谢!

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值