SHC can be used to encrypt shell scripts, which can be converted into an executable binary file. After SHC the shell script, it generates two new files at the same time, one is the encrypted executable binary (the filename ends with. x), and the other is the original file in C (the filename ends with the. x.c).
Here's how to install, SHC, and use examples:
Download installation:
(Website download address: http://www.datsi.fi.upm.es/~frosal/sources/)
Copy Code code as follows:
# wget Http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
# CD shc-3.8.7
# make
# make Install
(Only make can complete the installation, when running SHC to point out absolute path; with make install, install SHC to/usr/local/bin, you can run directly)
Common parameters:
Copy Code code as follows:
-E Date
Expiration date in dd/mm/yyyy format [None] (Specify expiration date)
-M message
Messages to display upon expiration ["Please contact your provider"] (specify expiration prompt information)
-F Script_name
File name of the script to compile (specifies the path and filename of the shell to be compiled)
-R Relax Security.
Make a redistributable binary which executes on different systems the running same system. (can be used in different systems of the same operating system Line
-V Verbose Compilation (details of compilation)
Use examples:
Copy Code code 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 an expiration date of October 20, 2010
-M: Print out information after expiration;
-v:verbose
-R: Can be performed on different hosts on the same operating system
-F: Specify source shell
Method:
Copy Code code as follows:
Note: To have the-r option,-F is followed by the name of the script to be encrypted.
Two files will be generated after the run, script-name.x and SCRIPT-NAME.X.C
Script-name.x is an executable binary file that is encrypted.
./script-name.x can be run.
SCRIPT-NAME.X.C is the original file that generates script-name.x (C language)
Description
After my test, the same in the operating system, the SHC executable binaries can be directly ported to run, but different operating systems may have problems, such as I CentOS5.4 the source shell after the encryption moved to the Redhat As5u4 can not run, appear "floating point Exception "error prompts, but it is no problem to move to another CentOS5.4 to run directly.