{"id":16680069,"url":"https://github.com/chenyukang/rshc","last_synced_at":"2025-04-09T22:33:45.278Z","repository":{"id":57663656,"uuid":"163200752","full_name":"chenyukang/rshc","owner":"chenyukang","description":" rshc: Compile shell script to Rust code and binary.","archived":false,"fork":false,"pushed_at":"2021-08-26T00:25:23.000Z","size":59,"stargazers_count":18,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T00:37:06.962Z","etag":null,"topics":["binary","code-generator","rust","shell"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rshc","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenyukang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-26T17:02:33.000Z","updated_at":"2024-03-07T10:49:59.000Z","dependencies_parsed_at":"2022-09-13T07:00:51.840Z","dependency_job_id":null,"html_url":"https://github.com/chenyukang/rshc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenyukang%2Frshc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenyukang%2Frshc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenyukang%2Frshc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenyukang%2Frshc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenyukang","download_url":"https://codeload.github.com/chenyukang/rshc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248124006,"owners_count":21051575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","code-generator","rust","shell"],"created_at":"2024-10-12T13:39:25.614Z","updated_at":"2025-04-09T22:33:45.254Z","avatar_url":"https://github.com/chenyukang.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rshc\n\n[![ci](https://github.com/chenyukang/rshc/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/chenyukang/rshc/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/chenyukang/rshc/branch/master/graph/badge.svg?token=AAQREZTXYK)](https://codecov.io/gh/chenyukang/rshc)\n\n\nrshc: Compile shell script(or expect script) to Rust code and binary.\n\n**This is an script obfuscator rather than a real compiler!**\n\nRshc takes a script, which is specified on the command line and produces Rust source code. \n\nThe generated source code is then compiled and linked to produce a stripped binary executable, which use the Rust compiler.\n\nActual execution will use process to exec the script, the but source code of script is encoded in binary with Rc4 algorithm.\n\nThis is used as:\n\n1. For the expect script which maybe contains some password, I will compile binary and remove the script.\n\n2. For some scripts which I want to add password for it.\n\n## Install\n\nYou need also install rustc, because rshc will use rustc to compile to binary.\n\n1. Install rustc if you didn't installed: \n\n```bash\ncurl https://sh.rustup.rs -sSf | sh\n```\n\n2. install the rshc cli app:\n\n```bash\ncargo install rshc\n```\n\n## Usage\n\n```rust\nrshc -f demo.sh -o demo.rs\n\n// add a passowrd when compile it, then binary will prompt for correct password before execution\nrshc -f demo.sh -o demo.rs -p\n```\n\ntry it with \n\n```shell\n./demo\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenyukang%2Frshc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenyukang%2Frshc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenyukang%2Frshc/lists"}