Installation and use of the Shell encryption tool SHC

Source: Internet
Author: User
Tags mysql backup

installation and use of the Shell encryption tool SHC

1) Tool Description
Shell scripts are read-write and are likely to leak sensitive information, such as username/password/path/IP. It also leaks sensitive information while the shell script is running. SHC is a tool for encrypting shell scripts, which is the role of converting shell scripts into an executable binary file. This is a good solution to the above problems.


2) Download and install
Download: http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.6.tgz(unofficial address)
Installation:
# mkdir-p/HOME/UPALL/SHC
# mkdir/usr/local/man/man1///install will put the man file into the directory, if the directory does not exist need to be built in advance
# tar-zvxf shc-3.8.6.tgz-c/HOME/UPALL/SHC && cd/home/upall/shcshc-3.8.6
# Make Test
# Make Strings
# make Install
Installing SHC and Shc.1 on/usr/local
Want to continue?< input y>
Install-c-S shc/usr/local/bin/
Install-c-M 644 shc.1/usr/local/man/man1/
#
Usage:
# which SHC//Find out where the program is, you can also use the "Whereis SHC"。
/usr/local/bin/shc
# SHC// View Help can be used shc-h or SHC--help, but the parameter is wrong, the program will automatically use instructions can you, but not all.
SHC Parse (-f): No source file specified
SHC USAGE:SHC [-E Date] [-M addr] [-I iopt] [-X CMND] [-L-lopt] [-rvdtcah]-F Script

3) Encryption script
# shc-v-F test.sh//"Encrypt" file "test.sh".
-V is the verbose mode, output more detailed compilation log;
-f Specifies the name of the script.
$ ll test*//View the file details, the prototype of this command is "Ls-l".
-rwxr-xr-x 1 Oracle Oinstall 1178 10:00am test.sh
-rwx--x--x 1 Oracle oinstall 8984 18:01 test.sh.x
-rw-r--r--1 Oracle oinstall 14820 18:01 test.sh.x.c
$ file test.sh.x//view file type of file "test.sh.x"
Test.sh.x:elf 32-bit LSB executable, Intel 80386, version 1 (SYSV), for Gnu/linux 2.2.5, dynamically linked (uses shared libs), stripped
You can see the generatedDynamic LinksExecutable binaries test.sh.x and C source file testup.sh.x.c, note that the generated binaries cannot be run on other platforms because they are dynamic link forms.

4) Generating a statically linked binary executable file
You can generate a statically linked binary executable file by using the following method:
$ cflags=-static shc-r-F test.sh
$ file testup.sh.x

5) Is it safe to encrypt script files via sch?
It's generally safe, but you can use GDB and other debugging tools to get the original source code. If you need a more secure approach, consider using WZSHSDK. In addition the SHC can also set the runtime and custom return information for the script:

$ shc-e 09/05/2010-m "The MySQL backup scrīpt is now out of date."-F test.sh
-e means that the script will expire before September 5, 2010 and be returned to the end user based on the information defined by-M.
Description: For MySQL, refer to my "MySQL management" backup operation or "Crontab" Backup script example at the end of the article.

Add: The tool named "Bat2exe" under win is converted to binary and can be executed at the command line.

< finish >

Installation and use of the Shell encryption tool SHC

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.