Using shc to compile your scripts does not protect them. Thus, you do not get more security. The compiled shc binary decrypts and loads the script into memory at startup. Then, right after you run the binary, just split it and extract the script from coredump.
Here is a small example script called test.sh:
#! /bin/bash
echo "starting script and doing stuff"
sleep 1
echo "finished doing stuff"
Compile it with shc:
shc -f test.sh
Run it as a background process and immediately execute it:
./test.sh.x& ( sleep 0.2 && kill -SIGSEGV $! )
sleep 0.2 will give the binary enough time to run and decrypt the original script. Variable $! contains the pid of the last background process, so we can easily kill it with a SIGSEGV segmentation failure signal (just like kill -11 $!).
[1] + segmentation fault (core dumped) ./test.sh.x
Now we can do a dump search for the original script:
cat core | strings
dumpfile , , script :
...
4.0.37(2)-release
BASH_VERSINFO
BASH_VERSINFO
release
i686-pc-linux-gnu
BASH_EXECUTION_STRING
BASH_EXECUTION_STRING
echo "starting script and doing stuff"
sleep 1
echo "finished doing stuff"
1000
EUID
EUID
1000
...
script , , ulimit.
, ?