All Projects → neurobin → Shc

neurobin / Shc

Licence: gpl-3.0
Shell script compiler

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects
perl
6916 projects
bash
514 projects
shellscript
22 projects

Projects that are alternatives of or similar to Shc

Colorechoforshell
Make 🐚(shell) 's 💬 (`echo`) to be 🌈 easily ✨ Support ✅ sh ➕ bash ➕ zsh ➕ ksh ➕ 🐟
Stars: ✭ 75 (-92.86%)
Mutual labels:  sh, zsh
Geo
🌎 A Bash utility for easy wan, lan, router, dns, mac address, and geolocation output, with clean stdout for piping
Stars: ✭ 225 (-78.57%)
Mutual labels:  sh, zsh
.dot Config
📚 Example dot configs for tmux, tmuxp, vim, vcspull, i3 and awesome
Stars: ✭ 102 (-90.29%)
Mutual labels:  sh, zsh
Breakdance
It's time for your markup to get down! HTML to markdown converter. Breakdance is a highly pluggable, flexible and easy to use.
Stars: ✭ 418 (-60.19%)
Mutual labels:  compile, converter
Promptless
🚀 A super fast and extremely minimal shell prompt.
Stars: ✭ 155 (-85.24%)
Mutual labels:  sh, zsh
Modernish
Modernish is a library for writing robust, portable, readable, and powerful programs for POSIX-based shells and utilities.
Stars: ✭ 586 (-44.19%)
Mutual labels:  sh, zsh
Pretty Git Prompt
`git status` inside your shell prompt
Stars: ✭ 43 (-95.9%)
Mutual labels:  zsh
Honukai Iterm Zsh
Honukai theme and colors for Oh My ZSH and iTerm
Stars: ✭ 1,034 (-1.52%)
Mutual labels:  zsh
Awesome Bash Alias
A curated list of awesome Bash aliases.
Stars: ✭ 43 (-95.9%)
Mutual labels:  zsh
Dotfiles
This is my dotfiles.
Stars: ✭ 41 (-96.1%)
Mutual labels:  zsh
Luneta
command-line fuzzy finder
Stars: ✭ 49 (-95.33%)
Mutual labels:  zsh
Binary Exploitation
Good to know, easy to forget information about binaries and their exploitation!
Stars: ✭ 47 (-95.52%)
Mutual labels:  binary
Ost2pst
OST2PST - converts Outlook OST files to PST format
Stars: ✭ 46 (-95.62%)
Mutual labels:  converter
Ssfconv
Sogou input method skin file (.ssf file) converter, supports conversion to fcitx or fcitx5 format.
Stars: ✭ 44 (-95.81%)
Mutual labels:  converter
Beeschema
Binary Schema Library for C#
Stars: ✭ 46 (-95.62%)
Mutual labels:  binary
Fzf Fasd
🌸 fzf + fasd integration
Stars: ✭ 43 (-95.9%)
Mutual labels:  zsh
Php54 Arrays
Command-line script to convert between array() and PHP 5.4's short syntax []
Stars: ✭ 47 (-95.52%)
Mutual labels:  converter
Dotfiles
@anmoljagetia's Dotfiles! Saves me several seconds!
Stars: ✭ 42 (-96%)
Mutual labels:  zsh
Gitstatus
Git status for Bash and Zsh prompt
Stars: ✭ 1,024 (-2.48%)
Mutual labels:  zsh
Dotfiles
My dotfiles 🚀. Includes configs for neovim, tmux, zsh, alacritty and more.
Stars: ✭ 47 (-95.52%)
Mutual labels:  zsh

build status image GitHub stars GitHub forks GitHub 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

./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 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

./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
  2. Web Page

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):

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].