shell 加密
来源:互联网 发布:音乐动画相册制作软件 编辑:程序博客网 时间:2024/06/07 00:34
很多时候,我们的脚本中涉及的用户名/密码/ip等敏感信息,我们需要使用一些加密方面来屏蔽这些信息,确保我们的系统安全(主要防菜鸟),虽然shc可以实现强大的加密功能,但是他需要另外安装shc软件,比较麻烦,应对一般的加密,个人推荐直接喜用系统自带的gzexe(大部分Linux,unix都有)
[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
#!/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即可实现原脚本功能
优点:在大部分系统上均可运行,不用安装额外软件
缺点:破解容易,放君子不防小人
使用 gzexe -d xifenfei.sh 就可以解密了,同时,生成一个xifenfei.sh~的文件。
0 0
- shell 加密
- linux加密登陆shell
- shell 脚本加密
- shell 脚本加密
- 加密 shell perl源代码
- shell脚本加密
- 用shc 加密shell
- shell脚本加密
- shell脚本加密
- Linux shell脚本加密
- 加密shell命令
- Shell脚本加密
- shc加密shell原理
- shell脚本加密
- shell脚本加密
- shell加密,java&shell互相调用
- [shell]采用shc工具加密Shell脚本
- Shell 脚本加密工具shc
- 响应性原则之三:用户界面是实时接口
- 原子操作(atomic operation)
- dom对象和Jquery对象搞混了,概念不清楚
- 定制Linux系统原理
- MAC COCOA一个简单的多线程程序
- shell 加密
- show engine innodb status发现deadlock
- Git简易教程
- android的Context Menu菜单
- ffmpeg不是线程安全的
- [异步][事务][流程][设计]同步当场处理并返回处理结果,异步后如何返回. 如何解决?
- 【Android UI界面】ListView与arrays.xml结合使用的问题
- framework新增jar包
- cocos2d-x 3.0rc开发指南:Windows下Android环境搭建