Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the shc tool to encrypt shell scripts

Shulou Source: shulou.com Published: 2022-06-03 09:19:39 10月23日 Update

This article mainly explains "how to use shc tools to encrypt shell scripts", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "how to use shc tools to encrypt shell scripts"!

Shc can be used to encrypt shell scripts and convert shell scripts into executable binary files. When shell scripts are encrypted by shc, two new files are simultaneously generated: an encrypted executable binary file (with a file name ending in.x) and the original C file (with a file name ending in. x.c).

Here are some examples of how to install shc:

Download and install:

(Official website download address: http://www.datsi.fi.upm.es/~frosal/sources/)

The code is as follows:

# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz

# cd shc-3.8.7

# make

# make install

(Just use make to complete the installation, point out the absolute path when running shc; use make install to install shc under/usr/local/bin, you can run it directly)

Common parameters:

The code is as follows:

-e date

Expiration date in dd/mm/yy format [none]

-m message

message to display upon expiration ["Please contact your provider"]

-f script_name

File name of the script to compile

-r Relax security.

Make a redistributable binary which executes on different systems running the same operat-ing system. (Can be executed on different systems within the same operating system)

-v Verbose compilation

Examples of usage:

The code is as follows:

[root@centos54 tmp]# /usr/local/src/shc-3.8.7/shc -e 20/10/2010 -m "lianxi aaa@163.com" -v -r -f ./ ex.sh

-e: Specify expiration date 20 October 2010

-m: information printed after expiration;

-v: verbose

-r: Executable on different hosts with the same operating system

-f: Specify the source shell

Methods:

The code is as follows:

shc -r -f script-name

Note: To have the-r option, -f is followed by the script name to encrypt.

Two files are generated,script-name.x and script-name.x.c

script-name.x is an encrypted executable binary file.

./ script-name.x is ready to run.

script-name.x.c is the original file (c language) that generates script-name.x

At this point, I believe everyone has a deeper understanding of "how to use shc tools to encrypt shell scripts," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: File encryption script code run tool binary file name system build different same operating system information content parameter method example language path Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker OPPO Reno vpn Xiaomi