shc icon indicating copy to clipboard operation
shc copied to clipboard

shellscript compiled in mac wont run on unix

Open ghost opened this issue 5 years ago • 5 comments

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

ghost avatar Mar 17 '19 05:03 ghost

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.

FOSSONLY avatar Mar 18 '19 03:03 FOSSONLY

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

rouben avatar Dec 21 '19 21:12 rouben

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

niansa avatar Feb 27 '20 17:02 niansa

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, Rouben[email protected] 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.

ghost avatar Feb 28 '20 03:02 ghost

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

Neved4 avatar Oct 06 '22 21:10 Neved4