Date: June 15, 2026
shc - Generic shell script compiler
shc [ -e DATE ] [ -m MESSAGE ] [ -i IOPT ] [ -x CMD ] [ -l LOPT ] [ -o OUTFILE ] [ -2ABCDHpPSUhrv ] -f SCRIPT
shc creates a stripped binary executable version of
the script specified with -f on the command line.
The binary version will get a .x extension appended by
default if OUTFILE is not defined with [-o OUTFILE]
option and will usually be a bit larger in size than the original ascii
code. Generated C source code is saved in a file with the extension
.x.c or in a file specified with appropriate option.
If you provide an expiration DATE with the -e option,
the compiled binary will refuse to run after the date specified. The
message Please contact your provider will be displayed
instead. This message can be changed with the -m
option.
You can compile any kind of shell script, but you need to supply
valid -i, -x and -l options.
The compiled binary will still require the shell specified in the
first line of the shell code (i.e. #!/bin/sh or
#!/usr/bin/env bash) to be available on the system. It now
includes absolute out-of-the-box compiler support for modern and legacy
shells (ksh88, ksh93, mksh, pdksh, fish, nu, pwsh, powershell, yash,
osh, elvish) as well as global compatibility support for
env wrapper interpretation with complex parameter chaining.
Therefore shc does not create completely independent
binaries, it mainly obfuscates the source script.
shc itself is not a compiler such as cc, it rather
encodes and encrypts a shell script and generates C source code with the
added expiration capability. It then uses the system compiler to compile
a stripped binary which behaves exactly like the original script. Upon
execution, the compiled binary will decrypt and execute the code with
the shell -c option. It will not give you any speed
improvement as a real C program would.
shc’s main purpose is to protect your shell scripts from modification or inspection. You can use it if you wish to distribute your scripts but don’t want them to be easily readable by other people.
[none]
["Please contact your provider"]
python, perl and csh.
-e
exec(\\'%s\\',@ARGV);
--
cat /proc/pid/cmdline, ptrace, etc… This
feature is experimental and may not work on all
systems. it requires bourne shell (sh) scripts
mmap2 system call.
These can be used to provide options to the GCC Compiler. Examples: static compilation, machine architecture, sanitize options.
[cc]
[none]
[none]
Compile a script which can be run on other systems with the trace
option enabled (without -U flag):
shc -f myscript -o mybinaryCompile an untraceable binary:
shc -Uf myscript -o mybinaryCompile an untraceable binary that doesn’t require root access (experimental):
shc -Hf myscript -o mybinaryThe maximum size of the script that could be executed once compiled
is limited by the operating system configuration parameter
_SC_ARG_MAX (see sysconf(2))
HARRY DS ALSYUNDAWY - ALSYUNDAWY IT SOLUTION (Audit & Hardening 2026) Francisco Rosales frosal@fi.upm.es Md Jahidul Hamid jahidulhamid@yahoo.com
Note: Do not contact the original authors, they are no longer actively involved