BMurtagh
05-06-2003, 11:22 AM
hello. i was wondering how hard it would be to convert a fairly large bash script for Logic Install into php so i would then be able to encrypt the source and prevent any modifications outside of the ones i perform. i was thinking of converting it to php because i know you can run php from the command line and that way it'd be encrypted, but would still run from there and be safe. please let me know on how i should face this problem or if you have any suggestions for another tway to protect my bash script source.
rooshine
05-06-2003, 12:31 PM
I know there are some utilities that will compile a shell script into c or other languages. This way they can't be viewed or modified but are still used the same way. Check out http://www.gnu.org/...shc.html (http://www.gnu.org/directory/devel/shell/shc.html) It's open source and it works with Bash.
http://www.cactus.com/...shell-lock.html (http://www.cactus.com/products/cactus/shell-lock.html) also makes one, but it is very expensive.
Search for "shell script compilers." There are probably several others out there.
BMurtagh
05-06-2003, 04:03 PM
when you went to use shc, did you come across a lot of errors? i seem to be having trouble getting it to compile the shell script. it makes the file.x.c, i set it to +x to be executed, then when i run it, i get a lot of errors like:
./pru.sh.x.c: line 63: typedef: command not found
./pru.sh.x.c: line 64: static: command not found
./pru.sh.x.c: line 65: \307\073\022\376\371\134\117\236\304\011\171\222\050\334\150\161: command not found
./pru.sh.x.c: line 66: \332\126\145\131\211\210\076\211\073\154\252\072\017\125\131\057: command not found
./pru.sh.x.c: line 67: \265\073\307\322\113\067\147\274\253\233\330\133\100\135\321\130: command not found
./pru.sh.x.c: line 68: \157\375\242\270\362\002\1
BMurtagh
05-06-2003, 04:05 PM
i also get this when doing, ./shc -f ../menu.sh
../menu.sh.x.c: In function `untraceable':
../menu.sh.x.c:902: `PTRACE_ATTACH' undeclared (first use in this function)
../menu.sh.x.c:902: (Each undeclared identifier is reported only once
../menu.sh.x.c:902: for each function it appears in.)
./shc: Unknown error: 0
Eric Lim
05-06-2003, 04:08 PM
I didn't compile it, but look at the makefile, you should be able to simply run shc at the shell prompt.
Do a make test and see how it works?
Eric Lim
05-06-2003, 04:59 PM
Downloas the file, the follow the below commands:
tar -zxvf shc-3.4.tgz
cd shc-3.4
make
make test
Then run ./shc -f filename
You didn't do the 'make', read the file shc.READM.
BMurtagh
05-06-2003, 05:13 PM
i did do the make, and when i do, i get this error:
In file included from match.x.c:85:
/usr/include/stdlib.h:111: warning: ANSI C does not support `long long'
/usr/include/stdlib.h:117: warning: ANSI C does not support `long long'
match.x.c: In function `untraceable':
match.x.c:256: `PTRACE_ATTACH' undeclared (first use in this function)
match.x.c:256: (Each undeclared identifier is reported only once
match.x.c:256: for each function it appears in.)
./shc: Invalid argument
*** Error code 1
Stop in /usr/home/brendan/shc-3.4.
Eric Lim
05-06-2003, 05:28 PM
Which version of g++ you're using, and what systems you're on?
That scripts require ISOC99 (if I am not wrong, but it looks like it.)
Edit the Makefile, erase the "all: shc test" it requires me to kill the test everytime I compile it.
You should be able to compile by now but maybe it wouldn't working till you upgraded to a version that supports ISOC99.
Have said goodbye to c quite a while ago, search google for more info or email the author. Good luck.