Encrypt script

Hi,
I have to encrypt my ash scripts on a distribution of linux with Armv5tejl Buildroot , I tried a lot of solutions but none works .
Someone can help me?
Thanks,
Nicola

Okay. Please define 'none works'. Specifically what errors are you getting? for example, maybe 'Illegal instruction'? We cannot help otherwise.

Post the error messages you get, along with an idea of what you are trying.

Thanks!

I tried to use SHC Shell Compiler but is only for bash script , I can't use make to install it , Can you recommend a useful method for me?

Hi,

According to the documentation for SHC (which I freely admit I'd not heard of before now, so bear that in mind) it doesn't itself care what shell you're using. So long as the initial shebang line (the #! line that should be at the top of every script to define what shell to use) is intact, it will run the de-compiled script through that shell. So whether it's ash , bash or something else entirely shouldn't be relevant.

As per Jim McNamara's reply, if you can give the exact full text of any errors you're getting, a complete description of what commands you're trying, and ultimately explain precisely what it is you're attempting to achieve (and the reasons why), then it might be possible to help you further.

Thanks of the reply, I do not very experienced as you can see, you can advise me a suitable method to My esigienze to encrypt a script ash shell?:confused:

This extremely common question always has the same inescapable conclusion.

Even if you shc it that doesn't prevent people from, say, copying it to a different machine without your permission, somewhere they can control what shell is used so as to extract the contents.

Yes, but --

Encryption does not work that way.

But what if --

Encryption does not work that way.

Maybe if it --

Encryption does not work that way.

To prevent people from reading your scripts/passwords, chmod.

To prevent people getting access to something which reads the scripts/passwords, sudo.

To prevent root from getting at it... You're out of luck.

2 Likes

Well. I'd say in case of compiling code there is no decryption. It's just binary code which can not be read and edited directly.

And SHC is a compile as I read it from what information google served me.

Of course you can use strace and figure out what's going on roughly. But this is not really that easy. And you cannot just add some lines of code here and there. Even though I would assume that it is not that difficult to exploit such shell scripts.

From my personal view Code-obfuscation and Code-Hiding is very annoying because you aren't able to fix or extend code anymore. Only good software producers that deliver rock solid code is a little less pain.

In very many cases, the code ist just bad and simple to fix bugs that can't be fixed are embarrassing.

1 Like

If it were just strings in an executable file, the "strings" command could strip them out trivially, but shc really is a code-hider and a bit trickier than that. It keeps it in an undisclosed manner and feeds the raw text into a shell, which makes it vulnerable. It takes measures to prevent itself from being traced, but can't stop you from copying the executable onto a machine you control, where you can force it to use an untrustworthy "shell".