1753720 Members
5001 Online
108799 Solutions
New Discussion юеВ

Re: Shell Compiler

 
SOLVED
Go to solution
Mark Philip L. Castro
Occasional Advisor

Shell Compiler

Is there such thing as a posix shell compiler or any thing software that can make your executable posix shell script unreadable but executable?
11 REPLIES 11
John Carr_2
Honored Contributor

Re: Shell Compiler

Hi

not sure exactly what you are trying to achieve but try this

cp /usr/bin/sh ~
cd ~
chmod 111 ./sh

ls -l ./sh

./sh

you have an executable shell with no read permissions

John.
Mark Philip L. Castro
Occasional Advisor

Re: Shell Compiler

Rephrasing my question, is there any way I can hide the contents of a posix shell SCRIPT so as to make the file executable but not readable?
Eric Antunes
Honored Contributor

Re: Shell Compiler

Try the following:

chmod ugo-rw <script>.sh
Each and every day is a good day to learn.
John Carr_2
Honored Contributor

Re: Shell Compiler

Hi

I do not think it is possible to compile a shell script to achieve this. You can however compile perl which will hide the code.

John.
John Carr_2
Honored Contributor

Re: Shell Compiler

I think Antunes is mistaken the script will not execute without read permission.

carrjo% chmod 111 test
carrjo% ls -la
total 418
drwxr-xr-x 2 carrjo root 96 Jun 4 08:51 .
drwxr-xr-x 23 root root 1024 May 27 13:56 ..
-rw------- 1 carrjo 1494 4 Jun 4 08:37 .sh_history
-rw-r--r-- 1 carrjo 1494 0 Mar 17 14:47 foo
---x--x--x 1 carrjo 1494 209136 Jun 4 08:36 ksh
---x--x--x 1 carrjo 1494 53 Jun 4 08:51 test
---------- 1 carrjo 1494 29 Mar 17 14:27 testfile
carrjo% ./test
./test: ./test: cannot open
carrjo% chmod 555 test
carrjo% ls -la
total 418
drwxr-xr-x 2 carrjo root 96 Jun 4 08:51 .
drwxr-xr-x 23 root root 1024 May 27 13:56 ..
-rw------- 1 carrjo 1494 4 Jun 4 08:37 .sh_history
-rw-r--r-- 1 carrjo 1494 0 Mar 17 14:47 foo
---x--x--x 1 carrjo 1494 209136 Jun 4 08:36 ksh
-r-xr-xr-x 1 carrjo 1494 53 Jun 4 08:51 test
---------- 1 carrjo 1494 29 Mar 17 14:27 testfile
carrjo% ./test
hello world
***********
ss1025:carrjo%
Eric Antunes
Honored Contributor

Re: Shell Compiler

Your're wright John, if I can├В┬┤t read it, I can├В┬┤t execut
Each and every day is a good day to learn.
Steve Lewis
Honored Contributor

Re: Shell Compiler

Look at this shell compiler:

http://www.comeaucomputing.com/faqs/ccshlit.html

These things have been around for a while.

Mark Philip L. Castro
Occasional Advisor

Re: Shell Compiler

where can I download or acquire this compiler?
John Carr_2
Honored Contributor
Solution

Re: Shell Compiler

Mark

you will have problems if you use the ccsh compiler Steve has pointed you to it is NOT the posix shell you have mentioned. You may be able to change your scripts to be the bourne shell then compile the script of course.

John.