← 返回命令列表

Linux command

shc 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Compile shell script

shc -f [script.sh]

Set expiration date

shc -e [31/12/2026] -f [script.sh]

Set expiration message

shc -m "[Script expired]" -f [script.sh]

Custom output name

shc -o [binary] -f [script.sh]

Relaxed security

shc -r -f [script.sh]

Hardened untraceable

shc -U -H -f [script.sh]

Verbose output

shc -v -f [script.sh]

说明

shc converts shell scripts into compiled binary executables by encrypting the script content and wrapping it in auto-generated C code. The resulting C source is compiled with the system's C compiler to produce a standalone binary that decrypts and executes the original script at runtime. The tool provides basic source code obfuscation rather than true security, since the script can be recovered from the binary with sufficient effort. Optional features include expiration dates that make the binary refuse to run after a specified date, and strict mode that binds the binary to the current host to prevent redistribution. Relaxed mode (-r) allows the binary to run on different systems. An intermediate .x.c file containing the generated C source is produced alongside the binary and can be inspected, modified, or compiled manually with different options.

参数

-f _SCRIPT_
Input shell script to compile
-o _FILE_
Output binary filename
-e _DATE_
Expiration date in dd/mm/yyyy format
-m _MESSAGE_
Message to display upon expiration (default: "Please contact your provider")
-r
Relaxed security, allow redistributable binary across systems
-v
Verbose compilation output
-U
Make binary untraceable (blocks truss, strace, ltrace, etc.)
-H
Hardening: extra protection against dumping, code injection, and ptrace
-S
Switch on setuid for root callable programs
-B
Compile for BusyBox
-D
Switch on debug exec calls
-i _inline_option_
Inline option for the shell interpreter
-x _command_
Exec command, as a printf format

FAQ

What is the shc command used for?

shc converts shell scripts into compiled binary executables by encrypting the script content and wrapping it in auto-generated C code. The resulting C source is compiled with the system's C compiler to produce a standalone binary that decrypts and executes the original script at runtime. The tool provides basic source code obfuscation rather than true security, since the script can be recovered from the binary with sufficient effort. Optional features include expiration dates that make the binary refuse to run after a specified date, and strict mode that binds the binary to the current host to prevent redistribution. Relaxed mode (-r) allows the binary to run on different systems. An intermediate .x.c file containing the generated C source is produced alongside the binary and can be inspected, modified, or compiled manually with different options.

How do I run a basic shc example?

Run `shc -f [script.sh]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f _SCRIPT_ do in shc?

Input shell script to compile