neurobin / shc

Shell script compiler
https://neurobin.org/projects/softwares/unix/shc/
GNU General Public License v3.0
2.03k stars 347 forks source link

shellscript compiled in mac wont run on unix #77

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi team,

I downloaded the shc-master and the latest shc-release as well. When I compile shc, there are no issues. When I encrypt my bash script and try to run on any unix server, it fails to run.

Also, it doesnt run well in busybox. I tried with simple echo command ->

------------------

!/bin/bash

echo "abcd"

------------------

Regards, Muralidhar N

FOSSONLY commented 5 years ago

The use of SHC has always been problematic, even if that would be a fine thing, of course. By the way, you can also encrypt shell scripts directly using GnuPG or OpenSSL. Then you simply insert the encrypted data into a shellscript, optionally as a variable or here-document, to pipe it to GnuPG or OpenSSL using a password. Alternatively, a public key could be used to automatically decrypt the shellscript wherever the corresponding private key exists, which would also be useful against unauthorized use.

rouben commented 4 years ago

Did you compile with -r to make sure the output is portable? AFAIK the compiler uses the shell interpreter itself as the encryption key (or derives the key from it), so if the interpreter binary file changes (updates/patches or run on another system), compiled script will fail to decrypt and run.

See issue #89

niansa commented 4 years ago

Mac binarys are different from linux ones, so it simply can't work!!!

ghost commented 4 years ago

Hi ruben,Will try today and let you know Regards MURALIDHAR N

Sent from Yahoo Mail on Android

On Sun, 22 Dec 2019 at 2:36 am, Roubennotifications@github.com wrote:
Did you compile with -r to make sure the output is portable? AFAIK the compiler uses the shell interpreter itself as the encryption key (or derives the key from it), so if the interpreter binary file changes (updates/patches or run on another system), compiled script will fail to decrypt and run.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Neved4 commented 2 years ago

Confirming this as per https://github.com/neurobin/shc/issues/76#issuecomment-1270699830.