LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Binary conversion....? (https://www.linuxquestions.org/questions/linux-newbie-8/binary-conversion-684598/)

nirmit 11-19-2008 07:34 AM

Binary conversion....?
 
hi
i have written shell scripts and i want to convert all these to binary.
So please tell me how can i convert these shell scripts into binary files.
I am using RedHat 7.0 and 3.0.

TB0ne 11-19-2008 08:03 AM

Quote:

Originally Posted by nirmit (Post 3347462)
hi
i have written shell scripts and i want to convert all these to binary.
So please tell me how can i convert these shell scripts into binary files.
I am using RedHat 7.0 and 3.0.

Write a program and compile it. Then you're done.

Seriously, you don't say what the scripts are written in now, what you're trying to do, or what programming language(s) you know. You say you want a 'binary' file...do you mean an encoded file that no one else can edit, or a compiled executable???

H_TeXMeX_H 11-19-2008 08:31 AM

Well if you wrote them in bash, there is no converting them to binary, there is no bash compiler. However, you can rewrite them in C or C++ and then compile them ... it will be rather difficult tho. But, why do you want to do this ? Are you sure you want to ?

rizwanrafique 11-19-2008 09:45 AM

There is something called ccsh available if you want to do bash >>> C

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

knudfl 11-19-2008 10:06 AM

man shc
shc creates a stripped binary executable version
of the script specified with -f on the command line.
http://www.datsi.fi.upm.es/~frosal/sources/shc.html

http://www.linuxsecurity.com/content/view/117920/171/

http://packages.debian.org/source/lenny/shc

H_TeXMeX_H 11-19-2008 10:31 AM

Quote:

Originally Posted by rizwanrafique (Post 3347601)
There is something called ccsh available if you want to do bash >>> C

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

wow, I didn't know it existed, well guess I was wrong, I guess you can compile bash, I'll have to try it.

EDIT: Darn, it isn't free ...

pixellany 11-19-2008 11:06 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 3347649)
EDIT: Darn, it isn't free ...

return to:

Quote:

But, why do you want to do this ? Are you sure you want to ?
For OP: The standard question is: What problem are you trying to solve? People typically write shell scripts for quick and dirty solutions (which can easily be changed). For a real application, where speed matters, write it in C.

i92guboj 11-19-2008 11:17 AM

There are some bash compilers around. But as far as I know, all that these do is to write a program that in turn, dumps the script into a temporary file and then run it. I might very well be wrong, but I don't think so.

If all you want is to hide the code, then these techniques are not exactly the best way to proceed because anyone should be able to look into that temporary file. So, write a program in C or whatever and compile it. Compiling bash is a lame trick that doesn't solve any problem of those that are inherent to bash.

knudfl 11-20-2008 12:23 AM

" Shc " mentioned in #5 encrypts a shell script.

http://aplawrence.com/Linux/shc.html

Regards

nirmit 11-20-2008 02:20 AM

thank a lot.
it will help me a lot to make my scripts secure.

schneidz 11-20-2008 09:15 AM

the other thing you can do is wrap the programs you call in the script in system() calls in c. but a crafty script-kiddie could use strings to grep thru your binary and get an idea of what you're doing.


All times are GMT -5. The time now is 02:23 PM.