LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-19-2008, 08:34 AM   #1
nirmit
Member
 
Registered: Feb 2008
Posts: 73

Rep: Reputation: 15
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.
 
Old 11-19-2008, 09:03 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,316

Rep: Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878Reputation: 3878
Quote:
Originally Posted by nirmit View Post
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???
 
Old 11-19-2008, 09:31 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
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 ?
 
Old 11-19-2008, 10:45 AM   #4
rizwanrafique
Member
 
Registered: Jul 2006
Distribution: Debian, Ubuntu, openSUSE, CentOS
Posts: 147

Rep: Reputation: 19
There is something called ccsh available if you want to do bash >>> C

http://www.comeaucomputing.com/faqs/ccshfaq.html
 
Old 11-19-2008, 11:06 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156
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
 
Old 11-19-2008, 11:31 AM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
Quote:
Originally Posted by rizwanrafique View Post
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 ...

Last edited by H_TeXMeX_H; 11-19-2008 at 11:37 AM.
 
Old 11-19-2008, 12:06 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by H_TeXMeX_H View Post
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.
 
Old 11-19-2008, 12:17 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
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.
 
Old 11-20-2008, 01:23 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156Reputation: 3156
" Shc " mentioned in #5 encrypts a shell script.

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

Regards
 
Old 11-20-2008, 03:20 AM   #10
nirmit
Member
 
Registered: Feb 2008
Posts: 73

Original Poster
Rep: Reputation: 15
thank a lot.
it will help me a lot to make my scripts secure.
 
Old 11-20-2008, 10:15 AM   #11
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal to binary conversion master General 10 12-21-2007 03:03 AM
binary to decimal conversion without using array (C programming) linuxi Programming 12 11-10-2006 06:21 PM
cout conversion to binary... audibel Programming 3 03-12-2005 08:06 AM
c++ binary to decimal conversion.. miguetoo Programming 13 04-24-2003 10:49 PM


All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration