|
|||||||||
| Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here. |
unix and linux commands - unix shell scripting |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
convert shell script into a binary executable
Hello every one, i want to convert my shell script into a binary executable a .exe file , is it possible to do that if so are there any tools . Would the script take off when the arguments are parsed.
Thanks Venu |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
|
| Sponsored Links | ||
|
|
|
#3
|
||||
|
||||
|
Am I being thick?
Well, this is something I have often pondered. A way to write code that is far more difficult to decipher - unless you have the source.
We have a number of intelligent users (if that's not an oxymoron) who like to read scripts and work out what they do and how. Of course, there are various sensitive things that we want to keep secret from them, yet give them the scripted ability to do. Nothing too complex, but it often involves privileged access to a database, for which we store the passwords in a file. Of course, if you can read the script, you know where to find the file! ![]() I grabbed at this link delighted that someone could solve all my woes, but I fail to get it to build. I have a few versions of AIX and two HPUX servers. From the README, it seems to suggest I just run a make, but that fails and I don't know even what it is trying to do. I've pretty much written everything as SQL or KSH (unless you count REXX on VM), so I've no experience in this. I did gcc compile the shc.c and get an executeable which I could then use to process test.ksh to create test.ksh.x, but this wouldn't run. Just the message "Killed" came back. Am I being a complete fool? ![]() Any pointers? "Hat's Off" to Jim for finding this if it works. |
|
#4
|
||||
|
||||
|
ksh93 comes with a compiler called shcomp Code:
$ cat test #!/bin/ksh for (( i=1; i<=5; i++)); do echo Hello World done $ ( echo '#!/bin/ksh' ; shcomp test ) > test.bin && chmod +x test.bin $ ./test.bin Hello World Hello World Hello World Hello World Hello World Which will not make it totally unreadable, but to a certain extent. Code:
$ od -c < test.bin 0000000 # ! / b i n / k s h \n \v 023 \b \0 003 0000020 \0 003 \f 002 005 i = 1 001 \0 005 \f 002 004 i 0000040 + + 001 \0 \f 002 006 i < = 5 001 \0 203 \0 0000060 @ \0 003 005 e c h o 006 H e l l o 006 W 0000100 o r l d \0 003 0000106 |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
shcomp doesn't really compile the script, but saves the parser tree that's generated internally. The script itself is still traceable using -x as if it were plain text.
shc, as suggested, will encrypt the script using RC4, but you'll lose the cross-platform advantage. Also, somehow it seems to dislike newer versions of Linux, or at least VirtualBox, as the compiled scripts always died. |
| The Following User Says Thank You to pludi For This Useful Post: | ||
Scrutinizer (12-10-2010) | ||
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
So, are there any suggestion how to get shc running? As a non-C person, I don't understand the compile process to get the tool installed, so I don't know what I'm looking for to fix it.
![]() Robin Liverpool/Blackburn UK Last edited by rbatte1; 12-21-2010 at 08:23 AM.. Reason: Grammer |
| Sponsored Links | |
|
|
#7
|
||||
|
||||
|
Are you on AIX 64 bit, as it looks like someone had a similar problem here and found a fix. You could also try the -T option to shc, this also got it working of AIX 5.3 64bit for me, also fixed `PTRACE_ATTACH' undeclared error when generating on cygwin: Code:
$ ./shc -T -f test.ksh $ ./test.ksh.x test params 1 2 3 + alias whence=type -a + alias ll=ls -l + alias la=ls -A + alias l=ls -CF + echo $@ is test params 1 2 3 $@ is test params 1 2 3 + echo command line: ./test.ksh.x test params 1 2 3 command line: ./test.ksh.x test params 1 2 3 + echo hello world hello world + echo [581760] PAUSED... Hit return! [581760] PAUSED... Hit return! + read DUMMY done + exit 0 ' BTW I think you probably need to set CC=gcc before trying the make (If not I might be able to help if you supply the error make is giving): Code:
$ CC=gcc ; export CC $ make |
| Sponsored Links | ||
|
|
![]() |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is there any script which convert binary file to CSV format | ahmad.diab | Shell Programming and Scripting | 14 | 11-09-2009 07:56 AM |
| can UNIX scripting be converted into binary(executable) | umarbangash | Shell Programming and Scripting | 5 | 08-21-2009 10:29 AM |
| running command prompt executable file in shell script | atl@mav | UNIX for Dummies Questions & Answers | 5 | 04-14-2009 12:14 PM |
| Linking Libaries to binary executable | bhavana | UNIX and Linux Applications | 0 | 07-27-2008 02:38 PM |
|
|