Compiling and Installing the shc Encryption Component on Linux to Encrypt Binary Files with One Click

7,569 0

Many people write Shell scripts for others to use, but do not want to make the source code public, so they need to encrypt their Shell scripts. There is a very useful Shell encryption component called shc on Linux.

Today, I’m bringing you a one-click installation script for shc, along with compilation and installation instructions. Those who like to tinker can choose to compile it themselves, while the one-click installation script is prepared for those who prefer convenience and beginners. Without further ado, here is the script!

Installation Script

Log in to the server via SSH and run the following command directly. Only one command is needed:

Plain Text
wget -qO- https://shc-install-script-url | bash

If you see the error bash: wget: command not found, run the following first:

Plain Text
yum -y install wget

Then run the one-click installation script again.

Compilation and Installation

Compilation must be performed in the root directory:

Bash
yum -y install gcc gcc-c++
wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
tar vxf shc-3.8.7.tgz
mkdir -p /usr/local/man/man1
cd shc-3.8.7
make test && make strings && make install

Usage

Example: encrypt xxxx.sh:

Bash
shc -r -v -f xxxx.sh
  • -r: Makes the script suitable for other operating systems
  • -v: Displays the encryption process
  • -f: Followed by the file to be encrypted

Two files will be generated after execution:

  • xxxx.sh.x: A binary file. After renaming it, grant it execute permission with chmod +x xxxx.sh, and it can then be executed.
  • xxxx.sh.x.c: A C language file. It is not needed and can be deleted.

Comments

(0)

No comments yet. Start the conversation.

Leave a comment