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

应用场景很多,如,中小项目大多使用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二进制文件
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容