分类: Python/Ruby
2010-11-01 11:20:06
用shc是很早以前的事了,今天看到群里在讨论,回顾一下:
shc的下载地址
最常用的把shell文件编译成二进制.x文件的方法:
[root@test tmp]# shc -v -r -f check_vipckcode.sh
[root@test tmp]# file check_vipckcode.sh.x
check_vipckcode.sh.x: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped
这与以C源码编译出来的可执行文件没什么区别,因此,你很难判定它源代码是C还是Shell写出来的,除非用特定的工具:
[root@test tmp]# file check_http
check_http: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
另外一种方式是采用静态编译:
CFLAGS=-static shc -r -f check_vipckcode.sh
[root@test tmp]# file check_vipckcode.sh.x
check_vipckcode.sh.x: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, statically linked, stripped
file命令的显示结果明显不一样了。
chinaunix网友2010-11-01 17:45:19
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com