?
Solved

converting bash script into binary??

Posted on 2007-04-01
11
Medium Priority
?
5,033 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 35

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
WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

 
LVL 48

Accepted Solution

by:
Tintin earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

771 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