Regarding shell scripts to executables


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Regarding shell scripts to executables
# 8  
Old 12-11-2007
If it's any consolation, trying to obscure a shell script goes against the UNIX philosophy of sharing solutions and avoiding reinventing the wheel.

Obscuring code doesn't even solve any security problems, for instance OpenSSH is totally open but still secure.

Somebody can easily reverse engineer your program by running it under a debugger or using a system trace tool.
# 9  
Old 12-11-2007
Quote:
Originally Posted by sanjay92
If you know well how to code in C.
What about solving & giving suggestions on how to solve this particular issue vs why you need this ?
The particular issue is that you want to do something different to what the tool was originally intended for.
If you pause for a moment and think about it, all of the procedural programming languages are functionally equivalent, and only differ in syntax. So something you can do in shell, you can do in perl, you can do in C.
You've just got to broaden your horizons a bit.
If you do choose to get a shell script compiler, then you are opening yourself (and your employers) up to a maintenance headache.
So, sometimes the answers to questions are not exactly what you wish to hear.
Life is like that...
# 10  
Old 12-11-2007
Porter,
I am not the orginal guy who created this thread in first place. His intention was not to look into code by some colleages but in our case, it is not the intention.
We use some Oracle monitoring scripts which logs on to oracle database with username/password
We don't want to let everybody see username/password and also don't want to hardcode password in shell script also even though users might have read permissions for script and hence we have used shc.

We don't put locks in our home to challenge that an experieced thief can't break the lock, it is just for normal folks who sometimes could change their mind Smilie.

Any way, thanks for your input.

-------------------------------------------------------
There was some other issues which we have even though make shc was okay.

$ ./shc -r -l "" -f pru.sh
pru.sh.x.c:246:24: sys/ptrace.h: No such file or directory
pru.sh.x.c: In function `untraceable':
pru.sh.x.c:274: error: `PTRACE_ATTACH' undeclared (first use in this function)
pru.sh.x.c:274: error: (Each undeclared identifier is reported only once
pru.sh.x.c:274: error: for each function it appears in.)
./shc: Error 0


In order to corrrect this issue, we need to modify shc.c and remove
include <sys/ptrace.h> since ptrace.h does not exists in Solaris 10
and
changed
mine = !ptrace(PTRACE_ATTACH, pid, 0, 0);",
To
mine = !ptrace(10, pid, 0, 0);",

and again make shc

It works okay.

I am writing this here since who knows some body may find this useful and looking for suggestions.
# 11  
Old 12-11-2007
Quote:
Originally Posted by sanjay92
We use some Oracle monitoring scripts which logs on to oracle database with username/password
If you pass the password in as either a command line argument or an environment variable then anyone who can run "ps" can see the password to the database. Smilie
# 12  
Old 12-11-2007
If you use the ksh93 shell, there is a command named shcomp that will convert a script into an intermediate machine independent form. ksh93 detects this format whenever it runs a script and execute directly from this intermediate format.
# 13  
Old 12-11-2007
Quote:
Originally Posted by porter
If you pass the password in as either a command line argument or an environment variable then anyone who can run "ps" can see the password to the database. Smilie
No way, that's where my utility comes in picture. We don't pass Password iin command line or store in profile.Smilie

We have Password file ( encrypted) which gets read with this code and decrypted on fly using openssl ( You don't see anything on ps or envionment variables)


$ getSQLPLUS SID system
Login using system@SID successful using tnsnames

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Dec 11 17:11:59 2007

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

SQL> !ps -ef |grep getS
oracle 28202 28159 0 17:12:11 pts/1 0:00 grep getS
oracle 28110 24930 0 17:11:58 pts/1 0:00 getSQLPLUS -c #!/bin/ksh################################################ # Fi
# 14  
Old 12-11-2007
Quote:
Originally Posted by fpmurphy
If you use the ksh93 shell, there is a command named shcomp that will convert a script into an intermediate machine independent form. ksh93 detects this format whenever it runs a script and execute directly from this intermediate format.
I have known about shcomp but never tried it. I could not find shcomp in my system , possibly, we don't have ksh93 or some package is not installed. How do I know whether I have ksh93 ?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Gcc cannot create executables

https://www.unix.com/302461112-post1.html Thank you. It's still in Linux Mint 17 (3 Replies)
Discussion started by: jgt
3 Replies

2. Shell Programming and Scripting

Scripting with executables

Hi everyone, I am working with an executable (let's say work) in bash shell. When I run this work executable it asks the following information; 1- choose task a or b 2- input file 3- output file 4- some operational choices after it reads the given input file, does some algebraic... (17 Replies)
Discussion started by: hayreter
17 Replies

3. Shell Programming and Scripting

Help: Makefile with multiple executables

I am trying to create executables for the following files Currently, I am making 9 different directories for for each. I would like to make 1 directory but everytime I try it does not work. CROSS_COMPILE?= # CROSS_COMPILE used to = arm-arago-linux-gnueabi... (1 Reply)
Discussion started by: bpetersen
1 Replies

4. Shell Programming and Scripting

Searching for executables

Hello Unix users, this is my first post here. :) I want to search a directory (and subdirectories) for executable files (files with rwx------ permission) and move them to a different folder. What Unix commands can accomplish this? (2 Replies)
Discussion started by: Sagan_Radiation
2 Replies

5. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

6. Programming

Compare two executables

Hi - I have two complex (for me at least) make files. The older one creates a succesful executable. The later one uses if statements to conditionally make different versions of the executable. The 2nd produces an executable that fails. I have "eyeballed" the differences in the Make files and run... (18 Replies)
Discussion started by: BrighterLater
18 Replies

7. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

8. Programming

executables ending with *

Hi All, I m very new to unix. I have a basic doubt .. In unix I m seeing that there is a * at the end of by executable name (exe1*).. Wht is the significance of that Thanks a lot in advance (2 Replies)
Discussion started by: binums
2 Replies

9. UNIX for Dummies Questions & Answers

cannot create executables

I am trying to install PROFTPD-1.2.7 on a SCO OpenServer 5.0.6 Server with a gcc-2.95.2 installed the VOLS files from http://www.caldera.com/skunkware. The problem I am having is when I try to run ./configure in the proftpd directory I get this error: # ./configure checking build system... (6 Replies)
Discussion started by: stufine
6 Replies

10. UNIX for Dummies Questions & Answers

cksum all executables on drive

I know I can run the cksum command for multiple files in a directory and send the results to a new file. EX.) # cd /usr # cksum *_ex* > /tmp/cksumusr.txt But I can't figure out how to run this command on multiple files in all directories on drive. Is it possible to do this, without having... (2 Replies)
Discussion started by: crazykelso
2 Replies
Login or Register to Ask a Question