Solved

converting bash script into binary??

Posted on 2007-04-01
11
5,028 Views
Last Modified: 2013-11-22
How to convert bash scripts into binary's, so noone can read it.
For example i just created script to set up NIS server as follows but anyone can view with just vi nis.sh cmd.
#vi makenis.sh
clear
echo "                       WELCOME TO NIS SEVER CREATOR"
echo
echo
mkdir /nisserver
if [ $? == 0 ]; then
echo
echo "A FOLDER NAMED /nisserver HAS BEEN CREATED FOR USER'S HOME DIRECTORY"
fi
cd /nisserver
echo
echo  "           ENTER THE USER NAME "
read x
echo "            ENTER THE NUMBER OF RECURSSION"
read y

if [ $y == 0 ]; then
echo "wrong choice try again"
else
      for i in $(seq 1 1 $y)
      do
            mkdir `echo $x`_$i
            useradd -d /nisserver/`echo $x`_$i `echo $x`_$i
            passwd `echo $x`_$i
            chown `echo $x`_$i /nisserver/`echo $x`_$i
            chgrp `echo $x`_$i /nisserver/`echo $x`_$i
            
      
done
fi
clear
echo "USERS ARE CREATED"
sleep 3
cd /var/yp/
cp -f /usr/share/doc/ypserv-2.13/securenets .
clear
echo "change the netmask to 255.255.255.0       192.168.0.0                                                                                                                    (range) mention it at bottom"
echo
echo "CHEAT CODE : highlight with help of mouse"
sleep 8
vi securenets
nisdomainname nisserver
clear
echo "NISDOMAINNAME CREATED AS nisserver "
echo
echo "NOW MENTION NISDOMAIN NAME PERMANENTLY"
sleep 5
vi /etc/sysconfig/network
clear
echo "now SHARE nissuser folder in /etc/exports AS:   /nisserver     *(rw,sync)"
echo
echo "CHEAT CODE : highlight with help of mouse"
sleep 8
vi /etc/exports
clear
echo "PRESS ctrl d AND PRESS y AND Enter"
sleep 2
echo
/usr/lib/yp/ypinit -m

sleep 2
service ypserv restart

service yppasswdd restart

service nfs restart
sleep 2
clear
echo "          CONGRATULATIONS YOU HAVE SUCCESSFULLY CREATED NIS SERVER"
echo
echo
echo
echo
echo
echo
echo "                          CREATED BY NAVEED - abhijeet"
sleep 5

0
Comment
Question by:w2kservers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 18831976
WHy don't you use
chmod 700 nis.sh

so only root/owner can access it...
0
 
LVL 19

Expert Comment

by:NickUpson
ID: 18832018
There is no mechanism I've every seen to convert a shell script into a binary, you could re-write it into C, such that each line of script was hard-coded into the C program and then compile that
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18833364
If the lines were hardcoded into a C program, the strings command would display them (or less, or cat -A). You would need to write a C program to programatically do what the shell script did. But and string constants would be visible. Why do you care so much?
If (as it seems) the file is only for use by root, then chmod 700 is the answer, as  TeRReF said.
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 18833720
See the following links for shell script compilers.  Essentially they work by encrypting the shell script and wrapping C code around it.  

http://www.datsi.fi.upm.es/~frosal/
http://www.comeaucomputing.com/faqs/ccshfaq.html
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 18835103
> How to convert bash scripts into binary's, so noone can read it.
Impossible. Dot.

shc already mentioned, but it also does not fit your requirement "noone can read" ;-)
0
 
LVL 48

Expert Comment

by:Tintin
ID: 18839693
ahoffmann.

You know as well as I do, that when most people say "no one can read it", they really mean "no one can easily read it".

shc is a perfectly acceptable solution to prevent casual viewing of the source script.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 18839753
Why do people write different things than they mean?

Tintin, you know I'm picky as usual (when security counts;-)
0
 
LVL 48

Expert Comment

by:Tintin
ID: 18840291
Sometimes you have to read between the lines.

BTW, welcome back :-)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 18841542
damn, I only can write, never learned to read ...
0
 
LVL 16

Expert Comment

by:Hanno P.S.
ID: 21170170
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup Zone:
ACCEPT Tintin's comment {http:#18833720} as answer

Any objections should be posted here in the next 4 days. After that time, the question will be closed.
JustUNIX, Experts Exchange Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21198269
Forced accept.

Computer101
EE Admin
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question