加密 shell perl源代码

一般用到的shell或是perl脚本有个问题

就是明文,用户可读,这样有些例如密码、ip地址等信息就非常的不安全,为了解决这个问题,向大家介绍个一个好工具---shc。

=======shc相关资料=======
shc主页:
http://www.datsi.fi.upm.es/%7Efrosal/

shc帮助文件如下
shc Version 3.8.6, Generic Script Compiler
shc Copyright (c) 1994-2006 Francisco Rosales <frosal@fi.upm.es>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
 
    -e %s  Expiration date in dd/mm/yyyy format [none]
    -m %s  Message to display upon expiration ["Please contact your provider"]
    -f %s  File name of the script to compile
    -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     Relax security. Make a redistributable binary
    -v     Verbose compilation
    -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  <none>   C compiler flags
 
    Please consult the shc(1) man page.
==============================

这里以shell脚本为例,介绍shc的基本使用方法,如下:
$ shc -r -f test.sh

运行成功就会生成动态链接可执行二进制文件test.sh.x和C源文件test.sh.x.c, 注意生成的二进制文件因为是动态链接形式, 所以在其它平台上不能运行。

不过我们可以通过下面的方法生成一个静态链接的二进制可执行文件:

# CFLAGS=-static shc -r -f test.sh
# file test.sh.x
test.sh.x: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
statically linked, for GNU/Linux 2.6.9, stripped

疑问: 那通过sch加密后的脚本文件真的很安全吗?
解答:一般来说是安全的, 不过可以使用gdb和其它的调试工具获得最初的源代码. 如果你需要更加安全的方法, 可以考虑使用wzshSDK.

另外, sch还可以设置脚本的运行期限和自定义返回信息:
shc -e 03/31/2008 -m “the test script is now out of date.” -f test.sh

-e表示脚本将在2007年3月31日前失效, 并根据-m定义的信息返回给终端用户.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值