Shell 脚本加密的方法
Shc可以用来对shell脚本进行加密,可以将shell脚本转换为一个可执行的二进制文件。经过shc对shell脚本进行加密后,会同时生成两种个新的文件,一个是加密后的可执行的二进制文件(文件名以.x结束),另一个是C语言的原文件(文件名以.x.c结束)。shc 安装
yum -y install shc
参数介绍:
#shc -h
shc Version 3.9.6, Generic Shell Script Compiler
shc GNU GPL Version 3 Md Jahidul Hamid <jahidulhamid@yahoo.com>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-o outfile] [-rvDUCABh] -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: --
-o %s output filename
-r Relax security. Make a redistributable binary
-v Verbose compilation
-D Switch ON debug exec calls [OFF]
-U Make binary untraceable [no]
-C Display license and exit
-A Display abstract and exit
-B Compile for busybox
-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 man page.
-e:指定过期时间为2010年10月20日
-m:过期后打印出的信息;
-v: verbose
-r: 可在相同操作系统的不同主机上执行
-f: 指定源shell
使用方法:
shc -r -f script-name 注意:要有-r选项, -f 后跟要加密的脚本名.
运行后会生成两个文件,script-name.x 和 script-name.x.c
script-name.x是加密后的可执行的二进制文件.
./script-name 即可运行.
script-name.x.c是生成script-name.x的原文件(c语言)
热门日志
分类
- git(9)
 - Mac(7)
 - C(1)
 - memcache(1)
 - Python(32)
 - Vim(8)
 - sed(2)
 - ansible(3)
 - awk(4)
 - shell(3)
 - Django(4)
 - ssdb(1)
 - bat(4)
 - svn(0)
 - docker(1)
 - Tornado(1)
 - go(2)
 - 架构(19)
 - Vue(1)
 - game(2)
 - AI(1)
 - Windows(8)
 - Java(8)
 - Mysql(38)
 - Ajax(2)
 - Jsp(1)
 - Struts(8)
 - Linux(73)
 - JavaScript(39)
 - Staruml(0)
 - Mouth(1)
 - Html(6)
 - Php(102)
 - Message(51)
 - Lua(10)
 - Compute(1)
 - Redis(7)
 - Nginx(12)
 - Jquery(1)
 - Apache(1)
 - cocos2d-x(8)
 - about(1)
 

