Skip to content

chenyukang/rshc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rshc

ci codecov

rshc: Compile shell script(or expect script) to Rust code and binary.

This is an script obfuscator rather than a real compiler!

Rshc takes a script, which is specified on the command line and produces Rust source code.

The generated source code is then compiled and linked to produce a stripped binary executable, which use the Rust compiler.

Actual execution will use process to exec the script, the but source code of script is encoded in binary with Rc4 algorithm.

This is used as:

  1. For the expect script which maybe contains some password, I will compile binary and remove the script.

  2. For some scripts which I want to add password for it.

Install

You need also install rustc, because rshc will use rustc to compile to binary.

  1. Install rustc if you didn't installed:
curl https://sh.rustup.rs -sSf | sh
  1. install the rshc cli app:
cargo install rshc

Usage

rshc -f demo.sh -o demo.rs

// add a passowrd when compile it, then binary will prompt for correct password before execution
rshc -f demo.sh -o demo.rs -p

try it with

./demo

About

rshc: Compile shell script to Rust code and binary.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages