Shell Script Shell Script Encryption

Shell script encryption

 

A goal is a dream with a deadline. Much effort, much prosperity. 

Why encrypt shell scripts? Of course for safety!

Maybe the script involves passwords and the like and needs to be encrypted

1. Download and install the shc tool

There are many ways to protect the shell script program written by yourself. There are two easiest ways: 1. Encryption 2. Set the expiration time. The following is an example of the shc tool:

shc is a tool for encrypting shell scripts. Its role is to convert the shell script into an executable binary file.

1
2
3
4
5
6
7
8
9
[root@localhost ~] # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
[root@localhost ~] # tar xf shc-3.8.7.tgz
[root@localhost ~] # cd shc-3.8.7
[root@localhost shc-3.8.7] # mkdir /usr/local/shc
[root@localhost shc-3.8.7] # make test
[root@localhost shc-3.8.7] # make
[root@localhost shc-3.8.7] # make test
[root@localhost shc-3.8.7] # make strings
[root@localhost shc-3.8.7] # make install    #这步需要有root权限

to encrypt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost  test ] # ls
script.sh
[root@localhost  test ] # cat script.sh
#!/bin/bash
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
[root@localhost  test ] # shc -r -f script.sh
[root@localhost  test ] # ls
script.sh  script.sh.x  script.sh.x.c
[root@localhost  test ] # ./script.sh.x
[root@localhost  test ] # ./script.sh.x
123123
123123
123123<br>·····

A goal is a dream with a deadline. Much effort, much prosperity. 

Why encrypt shell scripts? Of course for safety!

Maybe the script involves passwords and the like and needs to be encrypted

1. Download and install the shc tool

There are many ways to protect the shell script program written by yourself. There are two easiest ways: 1. Encryption 2. Set the expiration time. The following is an example of the shc tool:

shc is a tool for encrypting shell scripts. Its role is to convert the shell script into an executable binary file.

1
2
3
4
5
6
7
8
9
[root@localhost ~] # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
[root@localhost ~] # tar xf shc-3.8.7.tgz
[root@localhost ~] # cd shc-3.8.7
[root@localhost shc-3.8.7] # mkdir /usr/local/shc
[root@localhost shc-3.8.7] # make test
[root@localhost shc-3.8.7] # make
[root@localhost shc-3.8.7] # make test
[root@localhost shc-3.8.7] # make strings
[root@localhost shc-3.8.7] # make install    #这步需要有root权限

to encrypt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost  test ] # ls
script.sh
[root@localhost  test ] # cat script.sh
#!/bin/bash
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
echo  "123123"
[root@localhost  test ] # shc -r -f script.sh
[root@localhost  test ] # ls
script.sh  script.sh.x  script.sh.x.c
[root@localhost  test ] # ./script.sh.x
[root@localhost  test ] # ./script.sh.x
123123
123123
123123<br>·····

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324651503&siteId=291194637