Go to the link https://www.datsi.fi.upm.es/~frosal/sources/ and download latest stable source for shc
in this case the latest source is shc-3.8.9b.tgz
1 ) cd /usr/local
2 ) sudo wget https://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
3 ) sudo tar -zxvf shc-3.8.9b.tgz
4) cd shc-3.8.9
5) make
6) make test
7) make strings
8) make expiration
9) mkdir -p /usr/local/man/man1
10) make install
now shc in installed on your system in /usr/local/bin
to encrypt the script
shc -help gives the complete information about how we can use the package
shc -help
shc Version 3.8.9b, Generic Script Compiler
shc Copyright (c) 1994-2015 Francisco Rosales <[email protected]>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
-e %s Expiration date in dd/mm/yyyy format [none]
-m %s Message to display upon expiration ["Please contact your provider"]
-f %s File name of the script to compile
-i %s Inline option for the shell interpreter i.e: -e
-x %s eXec command, as a printf format i.e: exec('%s',@ARGV);
-l %s Last shell option i.e: --
-r Relax security. Make a redistributable binary
-v Verbose compilation
-D Switch ON debug exec calls [OFF]
-T Allow binary to be traceable [no]
-C Display license and exit
-A Display abstract and exit
-h Display help and exit
Environment variables used:
Name Default Usage
CC cc C compiler command
CFLAGS <none> C compiler flags
Please consult the shc(1) man page.
###### simple encryption ####
write a test script like below
#!/bin/bash
echo Test Script
shc -f test
This will create 2 files test.x (executable binary) and test.x.c(C source code)
test.x is an executable file
test.x may or may not run on system depending upon kernel as it is non traceable
to overcome this problem we must compile our script as traceable and redistributable
so that it can run on any system by any user.
shc -Tf test (or you can write it in simple way shc -T -f test)
### Encryption with expiration date and message #####
provide expiration date with -e in dd/mm/yyyy format and with -m type a message which you want to display after script expiration
shc -e 01/01/2000 -m "This script expired.Contact your admin" -Tf test
sice the date is in past the encrypted script is already expired and after running ./test.x it will give message "This script expired.Contact your admin"
### The one more thing you can do with this is compile the C source code into the binary by below command.##
gcc -o <binary-file-name> test.x.c
This will create c compiled binary file of your script.
The only difference between the shc compiled binary and c compiled binary is shc compiled binary is stripped while the c compiled binary is not stripped. (non stripped binaries have debugging information built into it)
This is something different that you. should try.
in this case the latest source is shc-3.8.9b.tgz
1 ) cd /usr/local
2 ) sudo wget https://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
3 ) sudo tar -zxvf shc-3.8.9b.tgz
4) cd shc-3.8.9
5) make
6) make test
7) make strings
8) make expiration
9) mkdir -p /usr/local/man/man1
10) make install
now shc in installed on your system in /usr/local/bin
to encrypt the script
shc -help gives the complete information about how we can use the package
shc -help
shc Version 3.8.9b, Generic Script Compiler
shc Copyright (c) 1994-2015 Francisco Rosales <[email protected]>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
-e %s Expiration date in dd/mm/yyyy format [none]
-m %s Message to display upon expiration ["Please contact your provider"]
-f %s File name of the script to compile
-i %s Inline option for the shell interpreter i.e: -e
-x %s eXec command, as a printf format i.e: exec('%s',@ARGV);
-l %s Last shell option i.e: --
-r Relax security. Make a redistributable binary
-v Verbose compilation
-D Switch ON debug exec calls [OFF]
-T Allow binary to be traceable [no]
-C Display license and exit
-A Display abstract and exit
-h Display help and exit
Environment variables used:
Name Default Usage
CC cc C compiler command
CFLAGS <none> C compiler flags
Please consult the shc(1) man page.
###### simple encryption ####
write a test script like below
#!/bin/bash
echo Test Script
shc -f test
This will create 2 files test.x (executable binary) and test.x.c(C source code)
test.x is an executable file
test.x may or may not run on system depending upon kernel as it is non traceable
to overcome this problem we must compile our script as traceable and redistributable
so that it can run on any system by any user.
shc -Tf test (or you can write it in simple way shc -T -f test)
### Encryption with expiration date and message #####
provide expiration date with -e in dd/mm/yyyy format and with -m type a message which you want to display after script expiration
shc -e 01/01/2000 -m "This script expired.Contact your admin" -Tf test
sice the date is in past the encrypted script is already expired and after running ./test.x it will give message "This script expired.Contact your admin"
### The one more thing you can do with this is compile the C source code into the binary by below command.##
gcc -o <binary-file-name> test.x.c
This will create c compiled binary file of your script.
The only difference between the shc compiled binary and c compiled binary is shc compiled binary is stripped while the c compiled binary is not stripped. (non stripped binaries have debugging information built into it)
This is something different that you. should try.
transported