gzexe加密shell脚本


[root@xifenfei tmp]# more xifenfei.sh

#!/usr/bin/ksh

echo'xifenfei--'`date`

[root@xifenfei tmp]# ./xifenfei.sh

xifenfei--Tue Mar 6 13:31:35 CST 2012

[root@xifenfei tmp]# ls -l xifenfei.sh

-rwxr-xr-x 1 root root 40 Mar  6 13:30 xifenfei.sh

--加密操作

[root@xifenfei tmp]# gzexe xifenfei.sh

xifenfei.sh:     -5.0%

[root@xifenfei tmp]# ls -l xifenfei.sh*

-rwxr-xr-x 1 root root 449 Mar  6 13:31 xifenfei.sh

-rwxr-xr-x 1 root root  40 Mar  6 13:30 xifenfei.sh~

--加密后文件内容

[root@xifenfei tmp]# strings xifenfei.sh

#!/bin/sh

skip=14

tmpdir=`/bin/mktemp-d ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit1

prog="${tmpdir}/`echo \"$0\" | sed 's|^.*/||'`"

if/usr/bin/tail-n +$skip "$0"| "/bin"/gzip-cd> "$prog"; then

/bin/chmod700 "$prog"

trap'/bin/rm -rf $tmpdir; exit $res'EXIT

"$prog"${1+"$@"}; res=$?

else

echo"Cannot decompress $0"

/bin/rm-rf $tmpdir

exit1

fi; exit$res

xifenfei.sh

UOHI,IM

这里的xifenfei.sh是加密后文件,xifenfei.sh~是源码文件(加密前文件),只需要运行xifenfie.sh即可实现原脚本功能
优点:在大部分系统上均可运行,不用安装额外软件
缺点:破解容易,放君子不防小人