用shc加密或者编译shell脚本

shell脚本有时候需要保存密码,比如登陆,ftp脚本.
有时候又需要是可执行文件的格式,比如在windows下的gvim中是没法直接调用shell脚本的,这就可以通过编译成可执行文件来调用.
shc是一个脚本编译工具, 使用RC4加密算法,讲shell脚本编译成动态链接或者静态链接的可执行文件.

下载地址:http://www.datsi.fi.upm.es/~frosal/
Cygwin环境下需要下载源代码并且用Cygwin自身的编译方式,编译成当前平台可以执行的格式,即调用cygwin1.dll.
shc最近一次更新是2010年2月

使用方式:
1.动态链接:
shc -v -r -T -f shellname.sh
shc会将脚本编译成c语言的代码,然后编译成可执行文件.
成功后可以看到生成了动态链接可执行二进制文件shellname.sh.x和C源文件shellname.sh.x.c

2.静态链接:
CFLAGS=-static shc -r -f shellname.sh

另外, sch还可以设置脚本的运行期限和自定义返回信息:
shc -e 04/31/2010 -m “the script is now out of date.” -f shellname.sh
-e表示脚本将在2010年4月31日前失效, 并根据-m定义的信息返回给用户.

选项:
The command line options are:

-e date
Expiration date in dd/mm/yyyy format [none]

-m message
message to display upon expiration ["Please contact
your provider"]

-f script_name
File name of the script to compile

-i inline_option
Inline option for the shell interpreter i.e: -e

-x comand
eXec command, as a printf format i.e:
exec(//'%s//',@ARGV);

-l last_option
Last shell option i.e: --

-r Relax security. Make a redistributable binary which
executes on different systems running the same operat-
ing system.

-v Verbose compilation

-D Switch on debug exec calls

-T Allow binary to be traceable (using strace, ptrace,
truss, etc.)

-C Display license and exit

-A Display abstract and exit

-h Display help and exit

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值