Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HOW TO: Cripting unix shell script

222 views
Skip to first unread message

Gianluca S.

unread,
Jul 19, 2005, 4:59:46 PM7/19/05
to
Hi all!!

I need to crypt a shell script (maked with korn shell) but i want that the
users of my system can run it...
Do you have an idea to make this operation?

Thanks in advance
Gianluca


nasir

unread,
Jul 19, 2005, 5:07:55 PM7/19/05
to
There are some 3rd party utilies to do that. Check out ShellGuard
http://www.fstha.com/
I am not sure if there is any bundled utility in Solaris or HPUX that
does that.

- nasir

johngnub

unread,
Jul 19, 2005, 5:17:37 PM7/19/05
to
>From my notes:
- Hooking the enc data from the gpg command. The command line will ask
for the pass to the file controled by gpg, the info var return will
have the info kept in the gpg file.

info=$(gpg -d foo.gpg 2>err |grep label)
echo "$info"

But, keep in mind, this will force a stdin passwd for the file that was
gpg. Also gpg is not avil on many OS.

OR:
Can you pass the word or even the shell via a env var. Then pass it
back out.

Some times:
To keep just any one from `more foo.sh` I use compress, then to run the
file, `zcat foo.ksh.Z
|ksh `

Just 2 cents. JB

Gianluca S.

unread,
Jul 19, 2005, 6:14:21 PM7/19/05
to
In my case i have sun solaris 5.8......work on it this suggestion?

Thanks
Gianluca

"johngnub" <john...@COX.NET> ha scritto nel messaggio
news:1121807857.6...@z14g2000cwz.googlegroups.com...

bsh

unread,
Jul 19, 2005, 7:01:18 PM7/19/05
to
Gianluca S. wrote:
> I need to crypt a shell script (maked with korn shell) but i want that the
> users of my system can run it...
> Do you have an idea to make this operation?

I interpret your use of "crypt" to mean "compile", not
"encrypt", which is something intrinsically different.

Gianluca, there are a variety of tools to "compile" scripts into
equivalent C source, "shroud" scripts with a binary executable shell,
or "obfuscate" the script source to discourage reuse, BUT all of
these techniques and resources either do not accomplish what you
want to do, are commercial software, or are for very specific
environments.

(Excuse me for the complex language of the above :)

Here is a list of all(?) available software that can do this.
You do not mention what your host system is, so you will have
to research and experiment yourself. I recommend "shcomp.c" as
part of the kornshell version 1993 package (free).

Reply to this newsgroup with your experience of success or
failure.

=Brian

COMPILE,"CCsh",,http://www.comeaucomputing.com/faqs/ccshfaq.html;http://www.comeaucomputing.com/tryccsh/,$$,"compile
sh(1)"
COMPILE,"shc.c",2.4;3.8,http://www.datsi.fi.upm.es/~frosal/;ftp://hpux.csc.liv.ac.uk/hpux/Languages/shc-2.4a,$0,"script
shrouder","Francisco Javier Rosales García" <fro...@fi.upm.es>
COMPILE,"shcomp.c",,<ast-ksh>/src/cmd/ksh93/{DESIGN,README,sh/shcomp.c},$0,"compile
ksh93 script","David G. Korn" <d...@research.att.com,d...@bell-labs.com>
COMPILE,"Shell
Protector",,http://www.bungisoft.com/html/purchase.html,$0,"compile
sh(1): NCA","Francisco Javier Rosales García" <fro...@fi.upm.es>
COMPILE,"Shell-Lock",,http://www.cactus.com/shellock.html;http://seclists.org/lists/bugtraq/1999/Oct/,$$,"compile
sh(1): NCA"
COMPILE,"ShellGuard;fstsg",0.2,http://www.fstha.com/sg.html,$0,"turn
shell (any) script into binary",<in...@fstha.com>
COMPILE,"wzshSDK",,http://wzce.tripod.com/wzsh.html,$$;/etc/wzshSDK.lic:Q420030915:fzRm2GospKi7UeyZ2EdWK0:DEMO4.4;KEY:177016496aa9ac0cb15322228117137d,"compile/encrypt
shellscript (Body:Apply for wzsh DEMO)","Roger Gong"
<wz...@hotvoice.com>

Stefaan A Eeckels

unread,
Jul 19, 2005, 7:00:37 PM7/19/05
to
On Tue, 19 Jul 2005 20:59:46 GMT
"Gianluca S." <gian...@email.it> wrote:

> I need to crypt a shell script (maked with korn shell) but i want that the
> users of my system can run it...
> Do you have an idea to make this operation?

ksh93, available from http://www.research.att.com/sw/download/
(package ast-ksh) contains shcomp, a utility that compiles ksh93
scripts to an intermediary (ie unreadable) format.
Whether this will work for your version of ksh I don't know, but you
can install ksh93 if the feature is important to you (there are
binaries for quite a few OSes on the AT&T site, but compiling from
source is pretty straightforward).

Take care,

--
Stefaan
--
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh

Dawid Michalczyk

unread,
Jul 24, 2005, 6:43:42 PM7/24/05
to
Gianluca S. wrote:
> Hi all!!
>
> I need to crypt a shell script (maked with korn shell) but i want that the
> users of my system can run it...
> Do you have an idea to make this operation?

I wrote a shell script obfuscator:
http://comp.eonworks.com/scripts/obfsh

--
Dawid Michalczyk
http://www.art.eonworks.com

Andrew Smallshaw

unread,
Jul 26, 2005, 3:23:35 PM7/26/05
to
On 2005-07-19, Gianluca S. <gian...@email.it> wrote:
> Hi all!!
>
> I need to crypt a shell script (maked with korn shell) but i want that the
> users of my system can run it...
> Do you have an idea to make this operation?

There is a tool called 'shc' specially designed for this purpose. Its
homepage is at http://www.datsi.fi.upm.es/~frosal/

--
Andrew Smallshaw
and...@sdf.lonestar.org

0 new messages