Linux生产服务器优化日记

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

2020-01-06  本文已影响0人  Saxon_323e

应用场景很多,如,中小项目大多使用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二进制文件
上一篇下一篇

猜你喜欢

热点阅读