上一篇: rpm 包制作 bind包
shc 加密Shell 脚本
[ 2010/09/01 09:41 | by selboo ]
下载安装 shc
wget ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el4/en/i386/RPMS.dag/shc-3.8.6-1.el4.rf.i386.rpm
加密Shell
[root@GameDB shc]# cat rsync.sh
#!/bin/bash
rsync -avz --delete 192.168.1.10::data /data/
[root@GameDB shc]# shc -rvf rsync.sh
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: sh.x.c -o rsync.sh.x
shc: strip rsync.sh.x
shc: chmod go-r rsync.sh.x
[root@GameDB shc]# ll
total 24
-rwxr-xr-x 1 root root 61 Sep 1 09:31 rsync.sh
-rwx--x--x 1 root root 7864 Sep 1 09:35 rsync.sh.x
-rw-r--r-- 1 root root 9591 Sep 1 09:35 rsync.sh.x.c
[root@GameDB shc]#
#!/bin/bash
rsync -avz --delete 192.168.1.10::data /data/
[root@GameDB shc]# shc -rvf rsync.sh
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: sh.x.c -o rsync.sh.x
shc: strip rsync.sh.x
shc: chmod go-r rsync.sh.x
[root@GameDB shc]# ll
total 24
-rwxr-xr-x 1 root root 61 Sep 1 09:31 rsync.sh
-rwx--x--x 1 root root 7864 Sep 1 09:35 rsync.sh.x
-rw-r--r-- 1 root root 9591 Sep 1 09:35 rsync.sh.x.c
[root@GameDB shc]#
rsync.sh.x 为加密文件
rsync.sh.x.c 为C源码可以直接编译
[root@GameDB shc]# gcc -Wall rsync.sh.x.c -o rsync
测试脚本
[root@GameDB shc]# ./rsync.sh.x
receiving incremental file list
sent 63 bytes received 346954 bytes 694034.00 bytes/sec
total size is 4684621446 speedup is 13499.69
[root@GameDB shc]# chmod 755 rsync
[root@GameDB shc]# ./rsync
receiving incremental file list
sent 63 bytes received 346954 bytes 231344.67 bytes/sec
total size is 4684621446 speedup is 13499.69
receiving incremental file list
sent 63 bytes received 346954 bytes 694034.00 bytes/sec
total size is 4684621446 speedup is 13499.69
[root@GameDB shc]# chmod 755 rsync
[root@GameDB shc]# ./rsync
receiving incremental file list
sent 63 bytes received 346954 bytes 231344.67 bytes/sec
total size is 4684621446 speedup is 13499.69
还可以设置脚本过期时间。
[root@GameDB shc]# shc -e 01/09/2010 -m "root@selboo.com.cn" -rvf rsync.sh
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc rsync.sh.x.c -o rsync.sh.x
shc: strip rsync.sh.x
shc: chmod go-r rsync.sh.x
[root@GameDB shc]# ./rsync.sh.x
./rsync.sh.x: has expired!
root@selboo.com.cn
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc rsync.sh.x.c -o rsync.sh.x
shc: strip rsync.sh.x
shc: chmod go-r rsync.sh.x
[root@GameDB shc]# ./rsync.sh.x
./rsync.sh.x: has expired!
root@selboo.com.cn
更多信息请
man
最后编辑: selboo 编辑于2012/01/18 14:51