From: skyste- on
Hello all,

I'm using shc (http://www.datsi.fi.upm.es/~frosal/) to compile some
shell script I use for monitoring purpose on remote systems. I've a
particular shell script that simply run a ps | grep to grep a process
given as argument and exit as 0 if it's ok or 1 if it's not ok.

This script runs from months on many systems (Linux 32/64bit, sunos 9,
aix 5.3/6.1).

I've compiled this script both on AIX and Linux. On AIX all is going ok.
On Linux I've found that sometimes this script seems not to found
requested process and obviously exit 1.

I'm in doubt if can be a problem of compiled version or not. I'm sure
that standard not compiled version works ok, this is running from many
months, but also I'm stracing the compiled version and seems that ps |
grep cause the problem.

Do you have any hint to debug more and/or try to solve this issue?


Thanks
Ste
From: Robert Harris on
skyste- wrote:
> Hello all,
>
> I'm using shc (http://www.datsi.fi.upm.es/~frosal/) to compile some
> shell script I use for monitoring purpose on remote systems. I've a
> particular shell script that simply run a ps | grep to grep a process
> given as argument and exit as 0 if it's ok or 1 if it's not ok.
>
> This script runs from months on many systems (Linux 32/64bit, sunos 9,
> aix 5.3/6.1).
>
> I've compiled this script both on AIX and Linux. On AIX all is going ok.
> On Linux I've found that sometimes this script seems not to found
> requested process and obviously exit 1.
>
> I'm in doubt if can be a problem of compiled version or not. I'm sure
> that standard not compiled version works ok, this is running from many
> months, but also I'm stracing the compiled version and seems that ps |
> grep cause the problem.
>
> Do you have any hint to debug more and/or try to solve this issue?
>
>
> Thanks
> Ste
What is the purpose of this "compilation"? It is a most unusual thing to do.

Robert
From: Noob on
Robert Harris wrote:

> What is the purpose of this "compilation"?

http://www.datsi.fi.upm.es/~frosal/sources/shc.html

According to the author

"""
shc's main purpose is to protect your shell scripts from
modification or inspection. You can use it if you wish to
distribute your scripts but don't want them to be easily
readable by other people.
"""

Thus, the tool's purpose is obfuscation.
From: WANG Cong on
On 09/17/09 16:18, Noob <root(a)127.0.0.1> wrote:

> Robert Harris wrote:
>
>> What is the purpose of this "compilation"?
>
> http://www.datsi.fi.upm.es/~frosal/sources/shc.html
>
> According to the author
>
> """
> shc's main purpose is to protect your shell scripts from
> modification or inspection. You can use it if you wish to
> distribute your scripts but don't want them to be easily
> readable by other people.
> """

This doesn't make much sense, you can do

chmod a-w your_script.sh
chmod a-r your_script.sh

to achieve this.

--
Live like a child, think like the god.

From: Ben Bacarisse on
WANG Cong <xiyou.wangcong(a)gmail.com> writes:

> On 09/17/09 16:18, Noob <root(a)127.0.0.1> wrote:
>
>> Robert Harris wrote:
>>
>>> What is the purpose of this "compilation"?
>>
>> http://www.datsi.fi.upm.es/~frosal/sources/shc.html
>>
>> According to the author
>>
>> """
>> shc's main purpose is to protect your shell scripts from
>> modification or inspection. You can use it if you wish to
>> distribute your scripts but don't want them to be easily
>> readable by other people.
>> """
>
> This doesn't make much sense, you can do
>
> chmod a-w your_script.sh
> chmod a-r your_script.sh
>
> to achieve this.

The latter makes it un-runnable as well, which probably defeats the
purpose of the script.

Anyway, the "other people" referred to are in fact "other people
you've given the script to" who probably get to choose the
permissions. Of course, they can also choose to undo the effect of
shc, but that is another matter.

The OP suggested the script was roughly one line long. I can't see
what purpose is served by even trying to obfuscate a one-liner.

--
Ben.