- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to convert bash scripts into binary's, so ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 01:09 AM
тАО01-14-2008 01:09 AM
Re: How to convert bash scripts into binary's, so no one can read it
>(You still haven't said why.)
I don`t want others to view/modify the shell script contents.
>Was this the gcc or cc run?
I belive it is cc ,Makefile has been attached along with reply
>Is shc executable?
I couldn`t find shc executable file in directory ,but shc.c and shc.1 is available
# pwd;ls shc;ls -l
/var/abi/shc1/shc-3.7
shc not found
total 272
-rwxrwxr-x 1 root sys 2474 Jun 18 2003 CHANGES
-rwxrwxr-x 1 root sys 17982 May 9 1996 Copying
-rwxrwxr-x 1 root sys 1564 Jan 14 12:00 Makefile
-rwxrwxr-x 1 root sys 256 Apr 16 2002 c2s.sed
-rwxrwxr-x 1 root sys 336 Feb 21 2003 match
-rwxrwxr-x 1 root sys 155 Jun 19 2003 pru.sh
-rwxrwxr-x 1 root sys 325 Apr 16 2002 s2c.sed
-rwxrwxr-x 1 root sys 3136 Jun 19 2003 shc.1
-rwxrwxr-x 1 root sys 1544 Jun 19 2003 shc.README
-rwxrwxr-x 1 root sys 21437 Jun 19 2003 shc.c
-rwxrwxr-x 1 root sys 3796 Jun 19 2003 shc.html
-rwxrwxr-x 1 root sys 138 Feb 21 2003 test.bash
-rwxrwxr-x 1 root sys 52 Jun 19 2003 test.csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 01:25 AM
тАО01-14-2008 01:25 AM
Re: How to convert bash scripts into binary's, so no one can read it
I apologize for the wrong reply for the 3rd query , please forgive me and have the correct reply
Is shc executable?
-rwxr-xr-x 1 root sys 39767 Jul 10 2006 shc
for more information :-
# pwd;ls -l;file shc
/var/abi/shc/shc-3.8.6
total 336
-rw-r--r-- 1 root sys 3549 Jul 10 2006 CHANGES
-rw-r----- 1 root sys 17982 May 9 1996 Copying
-rw-r----- 1 root sys 1525 Jun 16 2005 Makefile
-rwxr-x--- 1 root sys 336 Feb 21 2003 match
-rwxr-x--- 1 root sys 155 Jun 19 2003 pru.sh
-rwxr-xr-x 1 root sys 39767 Jul 10 2006 shc
-rw-r----- 1 root sys 3136 Jul 8 2004 shc.1
-rw-r----- 1 root sys 1544 Jun 19 2003 shc.README
-rw-r----- 1 root sys 24715 Jul 10 2006 shc.c
-rw-r----- 1 root sys 4558 Jul 8 2004 shc.html
-rwxr-xr-x 1 root sys 138 Nov 12 2004 test.bash
-rwxr-x--- 1 root sys 52 Jun 19 2003 test.csh
shc: ELF-32 executable object file
#
Thanks,
Abi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 01:52 AM
тАО01-14-2008 01:52 AM
Re: How to convert bash scripts into binary's, so no one can read it
Let me try to help.
I did not see you setting environment variable
CC to gcc or HP-UX acc.
You should firstly set it up and then
try to compile cleanly.
If you are going to use GCC, then set
CC=/usr/local/bin/gcc
(or wherever your gcc binary is)
Leave Makefile as it is because
it will use the last definition for:
# For GNU C compiler
CFLAGS = -Wall -O6 -pedantic
On the other hand, if you intend to use
acc, the set CC accordingly and
then comment out ALL but the following CFLAGS
line:
# For HPUX
CFLAGS = -Wall -O -Ae
I am not at my desk so I cannot check it
at the moment. But try this and let us know.
Interesting enough, I just found out
HP-UX Porting and Archive Centre
SHC bundles for a very old version of the
O/S and shc:
http://hpux.cs.utah.edu/hppd/hpux/Shells/shc-2.4a/
If there is enough interest, we could send an
email to the porting guys asking for
an updated version :)
Frankly, I would never advise anyone
to convert Shell script into binary.
No real benefits are achieved.
VK2COT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 02:12 AM
тАО01-14-2008 02:12 AM
Re: How to convert bash scripts into binary's, so no one can read it
Yes, cc, so those CFLAGS aren't valid.
>Is shc executable?
-rwxr-xr-x Jul 10 2006 shc
It shouldn't have this old date. It is probably for some foreign devil hardware. What does "file shc" show?
Try a "make cleanall".
>VK2COT: if you intend to use HP's C compiler, ... and then comment out ALL but the following CFLAGS line:
# For HPUX
CFLAGS = -Wall -O -Ae
No, this line is still garbage. You need "-Ae -O +wlint".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 02:19 AM
тАО01-14-2008 02:19 AM
Re: How to convert bash scripts into binary's, so no one can read it
Sorry, it looks like you did this:
shc: ELF-32 executable object file
So it should run and not get that error, since you are on IPF.
You still could cleanall and make everything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 05:33 AM
тАО01-14-2008 05:33 AM
Re: How to convert bash scripts into binary's, so no one can read it
Thanks for your advice , I will confirm you back on tomorrow
Thanks,
Abi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 07:26 AM
тАО01-14-2008 07:26 AM
Re: How to convert bash scripts into binary's, so no one can read it
as noted above, if we knew the "why" then there may be better methods of accomplishing it then obfuscating the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 10:45 PM
тАО01-14-2008 10:45 PM
Re: How to convert bash scripts into binary's, so no one can read it
Why you are trying to do this ?
I want to encrypt the script ( health check script) and execute the same in many servers by copying the script.
I tried crypt command ,but its not encoding well ,so I feel better to compile the script and copy to many customer site. If you can suggest better method than this its really help full for me and well appreciated .
Thanks,
Abi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2008 11:40 PM
тАО01-14-2008 11:40 PM
Re: How to convert bash scripts into binary's, so no one can read it
Thanks for your helping mind.
I tried what you said,but sorry to say I couldn`t succeed.Please have the below error and steps which I have performed.
# echo $CC
/usr/local/bin/gcc
# ldd /usr/local/bin/gcc
libintl.so => /usr/local/lib/hpux32/libintl.so
libc.so.1 => /usr/lib/hpux32/libc.so.1
libiconv.so => /opt/gtk2.6/lib/libiconv.so
libc.so.1 => /usr/lib/hpux32/libc.so.1
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
# make cleanall
rm -f *.o *~ *.x.c
rm -f shc *.x
# make test
/usr/local/bin/gcc -Wall -O6 -pedantic shc.c -o shc
*** Compiling script "match"
CFLAGS="-Wall -O6 -pedantic" ./shc -v -f match
shc shll=sh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: /usr/local/bin/gcc -Wall -O6 -pedantic match.x.c -o match.x
match.x.c:108: warning: string length '975' is greater than the length '509' ISO C90 compilers are required to support
match.x.c: In function 'untraceable':
match.x.c:289: error: too few arguments to function 'ptrace'
./shc: Error 0
*** Error exit code 1
Stop.
Thanks,
Abi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-15-2008 12:06 AM
тАО01-15-2008 12:06 AM
Re: How to convert bash scripts into binary's, so no one can read it
(I only know and support cc, not gcc.)
>match.x.c: In function 'untraceable':
match.x.c:289: error: too few arguments to function 'ptrace'
This indicates you don't have have enough args for ptrace.
If this is ptrace(2), this isn't supported on IPF. See the man page.