shc compiler to compile bash shell scripts into binary


shc is the only tool i’ve found that will compile scripts so idle hands won’t tamper with your bash shell scripts. Yes, I know I could just use permissions to keep people from reading them and it’s easy to reverse engineer the binary code, but I look at it like locking your car door; it’s a deterrent. It’s not hard to break into a car, you don’t even need to use the door. Thieves can just spider your window glass to get in, but door locks will keep the average joe out! Someone just tampering for a minute or two trying to tweak something probably won’t want to spend the time to effort breaking in.

make
make install
install -c /usr/local/bin -s shc /usr/local/bin
install -c /usr/local/man/man1 -s shc.1 /usr/local/man/man1

to compile a shell script into a binary executable:

shc -v -r -T -f filename.sh

Now you can run it like any normal executable…  If this doesn’t work for you, try an obfuscator.  Obfuscating your code might just be all you need, and it will still be the same script, just the spacing and comments will be different, to the human eye at least.

Try obfsh shell script obfuscator – inject deceiving comments and mess with blank lines, spacing and tabs.  Or just roll your own.  Rename all your variables to rediculous things or words that look like code, or reversed meanings.  Change the formatting, etc.  Get creative…

http://www.comp.eonworks.com/index.html



One thought on “shc compiler to compile bash shell scripts into binary

  1. Changing permissions to stop people hacking your code or stealing your ideas also stops them using the scripts – they need execute + read to run them.

    Where shc scores for me, is that I can release scripts containing my intellectual property, FTP passwords, and so on, for clients to run, without them doing things beyond their ability, or ripping off my bespoke work to resell.