[转帖]生产环境shell脚本安全之shc编译(转C)

生产,环境,shell,脚本,安全,shc,编译 · 浏览次数 : 0

小编点评

**SHC安装和使用指南** **1. SHC安装** - 下载交新版本:git clone  https://gitee.com/wl4g/shc.gitgit clone  https://github.com/neurobin/shc.gitcd shcgit checkout -b 4.0.3git pull origin 4.0.3mkdir -p /usr/local/man/man1./configuremake allsudo make install **2. 使用SHC** - 使用动态编译:# 动态编译shc -e '01/01/2021' -m 'This script expired, please contact authors!' -f mytest.sh#静态编译CFLAGs=-static shc -e '01/01/2021' -m 'This script expired, please contact authors!' -f mytest.sh# chmod go-r mytest.sh.x **3. 可选步骤:** - 创建可执行文件:./mytest.sh.x - 执行生成的C二进制文件。

正文

https://www.jianshu.com/p/17399dcd1471

 

应用场景很多,如,中小项目大多使用mysql,那么在你的mysqladmin备份脚本里可能存在明文的密码,此时由于公司服务器可能多个同事使用,那么转码加密脚本至关重要!

1,首先 SHC安装(建议使用交新版本,如 4.0.3):

源码下载:
git clone https://gitee.com/wl4g/shc.git

git clone https://github.com/neurobin/shc.git
cd shc
git checkout -b 4.0.3
git pull origin 4.0.3
mkdir -p /usr/local/man/man1
./configure
make all
sudo make install 

2,使用,如:

# 动态编译
shc -e '01/01/2021' -m 'This script expired, please contact authors!'  -f  mytest.sh
#静态编译
CFLAGs=-static shc -e '01/01/2021' -m 'This script expired, please contact authors!'  -f  mytest.sh
# chmod go-r mytest.sh.x  # 可选
./mytest.sh.x  # 执行生成的C二进制文件

与[转帖]生产环境shell脚本安全之shc编译(转C)相似的内容: