A generic shell script compiler. Shc takes a script, which is specified on the command line and produces C source code. The generated source code is then compiled and linked to produce a stripped binary executable.
The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e shebang) (i.e. #!/bin/sh), thus shc does not create completely independent binaries.
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.
./configure
make
sudo make install
Note If make
fails due to automake version, run ./autogen.sh
before running the above commands.
sudo add-apt-repository ppa:neurobin/ppa
sudo apt-get update
sudo apt-get install shc
If the above installation method seems like too much work, then just download a compiled binary package from release page and copy the shc
binary to /usr/bin
and shc.1
file to /usr/share/man/man1
.
shc [options]
shc -f script.sh -o binary
shc -U -f script.sh -o binary # Untraceable binary (prevent strace, ptrace etc..)
shc -H -f script.sh -o binary # Untraceable binary, does not require root (only bourne shell (sh) scripts with no parameter)
This flag is currently in an experimental state and may not work in all systems. This flag only works for default shell. For example, if you compile a bash script with -H
flag then the resultant executable will only work in systems where the default shell is bash. You may change the default shell which generally is /bin/sh
which further is just a link to another shell like bash or dash etc.
Also -H
does not work with positional parameters (yet)
./configure
make
make check
The one (and I hope the only) limitation using shc is the _SC_ARG_MAX system configuration parameter.It limits the maximum length of the arguments to the exec function, limiting the maximum length of the runnable script of shc.
!! - CHECK YOUR RESULTS CAREFULLY BEFORE USING - !!
If you want to make pull requests, please do so against the master branch. The default branch is release which should contain clean package files ready to be used.
If you want to edit the manual, please edit the man.md file (available in the master branch) instead and then generate the manual file from it with the command (requires pandoc
to be installed):
pandoc -s man.md -t man -o shc.1
#also run this command to generate the html manual
pandoc -s man.md -t html -o man.html
If you change anything related to autotools, please run ./autogen.sh
afterwards.
1) 工具说明 shell脚本是可读写的, 很有可能会泄露敏感信息, 如用户名/密码/路径/IP等. 同样在shell脚本运行时会也泄露敏感信息. shc是一个加密shell脚本的工具, 它的作用是把shell脚本转换为一个可执行的二进制文件. 这就很好的解决了上述问题. 2) 下载安装 下载: http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8
一、shc加密文件 Shc可以用来对shell脚本进行加密,可以将shell脚本转换为一个可执行的二进制文件。经过shc对shell脚本进行加密后,会同时生成两种个新的文件,一个是加密后的可执行的二进制文件(文件名以.x结束),另一个是C语言的原文件(文件名以.x.c结束)。 下面就说明一下shc的安装,参数,以及使用示例: (官网下载地址: http://www.datsi.fi.upm.es/
Shc可以用来对shell脚本进行加密,可以将shell脚本转换为一个可执行的二进制文件。经过shc对shell脚本进行加密后,会同时生成两种个新的文件,一个是加密后的可执行的二进制文件(文件名以.x结束),另一个是C语言的原文件(文件名以.x.c结束)。 下面就说明一下shc的安装,参数,以及使用示例: 下载安装: (官网下载地址: http://www.datsi.fi.upm.es/~fro
shell脚本加密工具shc shc是一个加密shell脚本的工具.它的作用是把shell脚本转换为一个可执行的二进制文件. 应用场景 用shell脚本对系统进行自动化维护,简单,便捷而且可移植性好.但shell脚本是可读写的,很有可能会泄露敏感信息,如用户名,密码,路径,IP等. 对于脚本中含有一些敏感信息的,通常我们都想做成二进制程序,不让用户看到源码,对于有这种需求的通常我们一般采用shc或
shc是一个加密shell脚本的工具,它的作用是把shell脚本转换为一个可执行的二进制文件。 1.下载: https://github.com/neurobin/shc https://codeload.github.com/neurobin/shc/zip/refs/heads/master 2.编译: ./configure && make && make install 3.使用: [r