Crates.io | rshc |
lib.rs | rshc |
version | 0.1.3 |
source | src |
created_at | 2018-12-28 06:51:11.201122 |
updated_at | 2018-12-29 15:05:37.830905 |
description | rshc: Rust compile shell script(or expect script) to Rust code and binary. |
homepage | https://github.com/chenyukang/rshc |
repository | https://github.com/chenyukang/rshc |
max_upload_size | |
id | 104180 |
size | 26,538 |
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:
For the expect script which maybe contains some password, I will compile binary and remove the script.
For some scripts which I want to add password for it.
You need also install rustc, because rshc will use rustc to compile to binary.
curl https://sh.rustup.rs -sSf | sh
cargo install rshc
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