[![build status image](https://travis-ci.org/neurobin/shc.svg?branch=release)](https://travis-ci.org/neurobin/shc)
[![GitHub stars](https://img.shields.io/github/stars/neurobin/shc.svg)](https://github.com/neurobin/shc/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/neurobin/shc.svg)](https://github.com/neurobin/shc/network)
[![GitHub issues](https://img.shields.io/github/issues/neurobin/shc.svg)](https://github.com/neurobin/shc/issues)
# Shell Script Compiler
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.
## Install
```bash
./configure
make
sudo make install
```
**Note** If `make` fails due to *automake* version, run `./autogen.sh` before running the above commands.
### Ubuntu-specific
```
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](https://github.com/neurobin/shc/releases/latest) and copy the `shc` binary to `/usr/bin` and `shc.1` file to `/usr/share/man/man1`.
## Usage
```
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)
```
## The hardening flag -H
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)**
## Testing
```bash
./configure
make
make check
```
## Known limitations
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 - !!
## Links
1. [Man Page](http://neurobin.github.io/shc/man.html)
2. [Web Page](http://neurobin.github.io/shc)
# Contributing
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):
```bash
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.
没有合适的资源?快使用搜索试试~ 我知道了~
三种将shel编译成可执行程序的工具
共83个文件
sh:21个
am:6个
c:6个
需积分: 1 0 下载量 131 浏览量
2023-12-02
10:28:34
上传
评论
收藏 310KB ZIP 举报
温馨提示
对shell代码进行保护,编译成可执行程序的工具
资源推荐
资源详情
资源评论
收起资源包目录
shc4.0.3.zip (83个子文件)
shc
shellcrypt-0.0.23
configure 133KB
ChangeLog 1KB
shellcrypt
Makefile.in 14KB
shellcrypt.c 5KB
Makefile.am 212B
README 3KB
aclocal.m4 31KB
NEWS 134B
example.sh 150B
AUTHORS 626B
configure.ac 251B
tests
test103.sh 486B
test102.sh 447B
test100.sh 255B
test1.sh 464B
test101.sh 267B
test201.sh 422B
test200.sh 621B
test3.sh 483B
test2.sh 512B
usefull
TestEverything.sh 370B
GetNewsItemsFromSourceForge.sh 296B
GetCommitMessageFromChangeLog.sh 121B
CommitToSourceForge.sh 434B
docs
myscript.sh 98B
shellcrypt_screenshot.png 64KB
README_developers 528B
TODO 815B
myscript.sh.bin 128B
profile.sh 507B
Makefile.in 18KB
shelldecrypt
shelldecrypt.c 4KB
Makefile.in 14KB
Makefile.am 188B
INSTALL 9KB
run.sh 272B
install-sh 13KB
libshellcrypt
shellcryptutils.c 5KB
shellcryptlib.h 247B
Makefile.in 13KB
shellcryptlib.c 613B
Makefile.am 126B
shellcryptutils.h 1016B
example.pl 199B
Makefile.am 217B
COPYING 34KB
missing 11KB
depcomp 17KB
shc-4.0.3
configure 172KB
autogen.sh 39B
ChangeLog 6KB
README 10B
aclocal.m4 41KB
.github
FUNDING.yml 118B
NEWS 0B
src
Makefile.in 17KB
shc.c 35KB
Makefile.am 87B
AUTHORS 108B
man.html 8KB
configure.ac 588B
man.md 4KB
Makefile.in 27KB
shc.1 4KB
INSTALL 15KB
test
pru.sh 154B
test.csh 49B
match 336B
ttest.sh 2KB
test.ksh 141B
testc.txt 133B
test.bash 144B
README.md 4KB
Makefile.am 185B
COPYING 34KB
config
compile 7KB
install-sh 15KB
missing 7KB
depcomp 23KB
shellc-0.1
说明.md 2KB
example.sh 145B
shellc.c 15KB
README.md 2KB
共 83 条
- 1
资源评论
nbczc
- 粉丝: 12
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功