Shell脚本二进制加密

Shell脚本转换成二进制加密、

1、我们需要对IP地址、账号密码进行简单保密。

2、下载安装shc-3.8.9.tgz

wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
[root@VM-20-2-centos soft]# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
--2022-01-13 14:03:40--  http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
Resolving www.datsi.fi.upm.es (www.datsi.fi.upm.es)... 138.100.9.22
Connecting to www.datsi.fi.upm.es (www.datsi.fi.upm.es)|138.100.9.22|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20687 (20K) [application/x-gzip]
Saving to: ‘shc-3.8.9b.tgz’

100%[=====================================================>] 20,687      81.9KB/s   in 0.2s   

2022-01-13 14:03:41 (81.9 KB/s) - ‘shc-3.8.9b.tgz’ saved [20687/20687]

[root@VM-20-2-centos soft]# 

3、解压shc-3.8.9b.tgz

[root@VM-20-2-centos soft]# tar zxvf shc-3.8.9b.tgz 
shc-3.8.9b/CHANGES
shc-3.8.9b/Copying
shc-3.8.9b/match
shc-3.8.9b/pru.sh
shc-3.8.9b/shc-3.8.9b.c
shc-3.8.9b/shc.c
shc-3.8.9b/shc.1
shc-3.8.9b/shc.README
shc-3.8.9b/shc.html
shc-3.8.9b/test.bash
shc-3.8.9b/test.csh
shc-3.8.9b/test.ksh
shc-3.8.9b/makefile
shc-3.8.9b/testit
[root@VM-20-2-centos soft]# 

4、编译安装

[root@VM-20-2-centos shc-3.8.9b]# make
cc -Wall  shc.c -o shc
***	¿Do you want to probe shc with a test script?
***	Please try...	make test
[root@VM-20-2-centos shc-3.8.9b]# make install
***	Installing shc and shc.1 on /usr/local
***	¿Do you want to continue? y
install -c -s shc /usr/local/bin/
install -c -m 644 shc.1 /usr/local/man/man1/
install: target ‘/usr/local/man/man1/’ is not a directory: No such file or directory
make: *** [install] Error 1
[root@VM-20-2-centos shc-3.8.9b]# 

备注:最开始在虚拟机上测试时,报错

[root@localhost shc-3.8.9b]# make install
cc -Wall  shc.c -o shc
make: cc:命令未找到
make: *** [shc] 错误 127

原因是没有安装gcc

yum -y install gcc automake autoconf libtool make
#执行这个安装就行

5、简单测试功能

[root@VM-20-2-centos ~]# mkdir scripts
[root@VM-20-2-centos ~]# cd scripts/
[root@VM-20-2-centos scripts]# ls
[root@VM-20-2-centos scripts]# vim hello.sh
[root@VM-20-2-centos scripts]# ls
hello.sh
[root@VM-20-2-centos scripts]# chmod +x hello.sh 
[root@VM-20-2-centos scripts]# ./hello.sh 
Hello,World!
[root@VM-20-2-centos scripts]# shc -r -f hello.sh 
[root@VM-20-2-centos scripts]# ll
total 28
-rwxr-xr-x 1 root root    32 Jan 13 14:11 hello.sh
-rwx--x--x 1 root root 11232 Jan 13 14:11 hello.sh.x
-rw-r--r-- 1 root root  9401 Jan 13 14:11 hello.sh.x.c
[root@VM-20-2-centos scripts]# mv hello.sh.x hello.sh
mv: overwrite ‘hello.sh’? n
[root@VM-20-2-centos scripts]# mv hello.sh.x hello
[root@VM-20-2-centos scripts]# ls
hello  hello.sh  hello.sh.x.c
[root@VM-20-2-centos scripts]# ./hello
Hello,World!
[root@VM-20-2-centos scripts]# 

总结:最后的hello.sh.x 就是二进制文件,hello.sh.x.c是改写的c语言。这个并不绝对保密。简单保密符合要求。更高级别的保密达不到。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值