Top

Linux-脚本加密

使用SHC给Shell脚本加密

我的环境是Centos7.4!1台服务器:Server

x.x.x.x-yiqie

↓原文来自

CentOS6.x安装shc3.8.9:https://blog.csdn.net/myiaas/article/details/50669410

1. 下载SHC软件包

[root@yiqie ~]# cd /data/soft/
[root@yiqie soft]# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz

2. 解压并安装

[root@yiqie soft]# tar -zxf shc-3.8.9b.tgz
[root@yiqie soft]# mv shc-3.8.9b /usr/local/shc
[root@yiqie soft]# cd /usr/local/shc/
[root@yiqie shc]# mkdir -p /usr/local/man/man1
[root@yiqie shc]# make test
[root@yiqie shc]# make strings
[root@yiqie shc]# make expiration
[root@yiqie shc]# make install
***     Installing shc and shc.1 on /usr/local
***     you want to continue? yes
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/

3. 加密文档

[root@yiqie shc]# cd /tmp/
[root@yiqie tmp]# vim scripts.sh
1
2
#!/bin/bash
echo "hehe"
[root@yiqie tmp]# bash scripts.sh hehe
↓ -e 时间、-m 信息、-r 可在相同操作系统的不同主机执行、-f 指定脚本.
[root@yiqie tmp]# shc -e 20/5/2019 -m "invalid" -r -f scripts.sh
↓生成了3个文件,第一个是原文件,第二个是二进制文件.
[root@yiqie tmp]# ls scripts.sh* scripts.sh scripts.sh.x scripts.sh.x.c
↓可以执行.
[root@yiqie tmp]# ./scripts.sh.x hehe