Problems using shc


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problems using shc
# 1  
Old 11-16-2010
Problems using shc

Hi all!


First of all, sorry for my poor english :-S


Well, I have some scripts in a SuSe server to encrypt... but all them must still working when I encrypt it, ok?

About the server, I have root access:

Code:
# id
uid=0(root) gid=0(root) groups=0(root)

# uname -a
Linux servername 2.6.16.60-0.42.4-smp #1 SMP Fri Aug 14 14:33:26 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux

# more /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2


So, I googled there out and I found 'shc'.

All the next commands were runned as user 'root'...

I have download and untar it in this path:/bin/magius/shc-3.8.6

Code:
# ls -lrt
total 128
-rw-r--r-- 1 root root 17982 1996-05-09 18:34 Copying
-rwxr-x--- 1 root root 336 2003-02-21 21:29 match
-rw-r--r-- 1 root root 1544 2003-06-19 17:12 shc.README
-rwxr-x--- 1 root root 155 2003-06-19 18:43 pru.sh
-rwxr-x--- 1 root root 52 2003-06-19 18:44 test.csh
-rw-r--r-- 1 root root 3136 2004-07-08 17:45 shc.1
-rw-r--r-- 1 root root 4558 2004-07-08 17:46 shc.html
-rwxr-xr-x 1 root root 138 2004-11-12 21:32 test.bash
-rw-r--r-- 1 root root 24715 2006-07-10 16:10 shc.c
-rw-r--r-- 1 root root 3549 2006-07-10 16:11 CHANGES
-rwxr-xr-x 1 root root 39767 2006-07-10 16:11 shc
-rw-r--r-- 1 root root 1592 2010-11-16 13:54 Makefile


So, as far as I know I must install it. I've tried several ways, like:

Code:
/bin/magius/shc-3.8.6 # make install
*** Installing shc and shc.1 on /usr/openv/netbackup/bin
*** ¿Do you want to continue? y
install -c -s shc /usr/openv/netbackup/bin/
install -c -m 644 shc.1 /usr/openv/netbackup/bin/man/man1/

# ls -lrt /usr/openv/netbackup/bin/shc
-rwxr-xr-x 1 root root 29044 2010-11-16 14:36 /usr/openv/netbackup/bin/shc

# ls -lrt /usr/openv/netbackup/bin/man/man1/shc.1
-rw-r--r-- 1 root root 3136 2010-11-16 14:36 /usr/openv/netbackup/bin/man/man1/shc.1


So, It looks good. Let's try it... the script "match" has execution permissions and do this:

Code:
/bin/magius/shc-3.8.6 # ./match
[24353] PAUSED... Hit return!


But when I try to use shc says all this:

Code:
/bin/magius/shc-3.8.6 # shc -f match
match.x.c:110:22: error: sys/stat.h: No such file or directory
match.x.c:111:23: error: sys/types.h: No such file or directory
match.x.c:113:19: error: errno.h: No such file or directory
match.x.c:114:19: error: stdio.h: No such file or directory
match.x.c:115:20: error: stdlib.h: No such file or directory
match.x.c:116:20: error: string.h: No such file or directory
match.x.c:117:18: error: time.h: No such file or directory
match.x.c:118:20: error: unistd.h: No such file or directory
stte_0 key arc4 key_with_file
match.x.c: In function 'key_with_file':
match.x.c:180: error: array type has incomplete element type
match.x.c:181: error: array type has incomplete element type
match.x.c:187: warning: incompatible implicit declaration of built-in function 'memset'
rmarg chkenv
match.x.c: In function 'chkenv':
match.x.c:232: warning: incompatible implicit declaration of built-in function 'sprintf'
match.x.c:233: warning: assignment makes pointer from integer without a cast
match.x.c:237: warning: incompatible implicit declaration of built-in function 'strlen'
match.x.c:241: warning: incompatible implicit declaration of built-in function 'strdup'
match.x.c:244: warning: incompatible implicit declaration of built-in function 'sscanf'
match.x.c:256:24: error: sys/ptrace.h: No such file or directory
match.x.c:258:22: error: sys/wait.h: No such file or directory
match.x.c:259:19: error: fcntl.h: No such file or directory
match.x.c:260:20: error: signal.h: No such file or directory
untraceable
match.x.c: In function 'untraceable':
match.x.c:279: warning: incompatible implicit declaration of built-in function 'sprintf'
match.x.c:282: error: 'O_RDWR' undeclared (first use in this function)
match.x.c:282: error: (Each undeclared identifier is reported only once
match.x.c:282: error: for each function it appears in.)
match.x.c:282: error: 'O_EXCL' undeclared (first use in this function)
match.x.c:283: error: 'errno' undeclared (first use in this function)
match.x.c:283: error: 'EBUSY' undeclared (first use in this function)
match.x.c:284: error: 'PTRACE_ATTACH' undeclared (first use in this function)
match.x.c:286: error: 'SIGCONT' undeclared (first use in this function)
match.x.c:289: error: 'SIGKILL' undeclared (first use in this function)
match.x.c:291: warning: incompatible implicit declaration of built-in function '_exit'
match.x.c:299: warning: incompatible implicit declaration of built-in function '_exit'
xsh
match.x.c: In function 'xsh':
match.x.c:312: error: 'time_t' undeclared (first use in this function)
match.x.c:312: error: expected expression before ')' token
match.x.c:313: error: expected expression before ')' token
match.x.c:328: warning: incompatible implicit declaration of built-in function 'calloc'
match.x.c:344: warning: incompatible implicit declaration of built-in function 'malloc'
match.x.c:347: warning: incompatible implicit declaration of built-in function 'memset'
match.x.c:348: warning: incompatible implicit declaration of built-in function 'memcpy'
match.x.c:354: warning: incompatible implicit declaration of built-in function 'malloc'
match.x.c:357: warning: incompatible implicit declaration of built-in function 'sprintf'
main
match.x.c: In function 'main':
match.x.c:391: warning: incompatible implicit declaration of built-in function 'fprintf'
match.x.c:391: error: 'stderr' undeclared (first use in this function)
match.x.c:392: error: 'errno' undeclared (first use in this function)

Execution times (seconds)
tree gimplify : 0.01 (100%) usr 0.00 ( 0%) sys 0.01 (20%) wall 69 kB ( 3%) ggc
TOTAL : 0.01 0.00 0.05 2445 kB
shc: Success




Maybe there are a problem with GCC or something like that...

I linked this:

Code:
# ls -lrt ./usr/local/bin/cc
lrwxrwxrwx 1 root root 19 2010-11-16 13:50 ./usr/local/bin/cc -> ./lib/libgcc_s.so.1

# ls -lrt ./usr/local/sbin/cc
lrwxrwxrwx 1 root root 42 2010-11-16 13:47 ./usr/local/sbin/cc -> /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc1


I look for gcc in the server:

Code:
# find ./ -name *gcc* -print
./opt/pdopensource/lib/libboost_system-gcc41-mt-1_36.a
./opt/pdopensource/lib/libboost_signals-gcc41-mt.a
./opt/pdopensource/lib/libboost_signals-gcc41-mt-1_36.a
./opt/pdopensource/lib/libboost_system-gcc41-mt-1_36.so
./opt/pdopensource/lib/libboost_thread-gcc41-mt-1_36.so.1.36.0
./opt/pdopensource/lib/libboost_filesystem-gcc41-mt-1_36.so
./opt/pdopensource/lib/libboost_thread-gcc41-mt-1_36.so
./opt/pdopensource/lib/libboost_filesystem-gcc41-mt.so
./opt/pdopensource/lib/libboost_filesystem-gcc41-mt.a
./opt/pdopensource/lib/libboost_signals-gcc41-mt-1_36.so.1.36.0
./opt/pdopensource/lib/libboost_thread-gcc41-mt-1_36.a
./opt/pdopensource/lib/libboost_system-gcc41-mt.so
./opt/pdopensource/lib/libboost_system-gcc41-mt-1_36.so.1.36.0
./opt/pdopensource/lib/libboost_thread-gcc41-mt.so
./opt/pdopensource/lib/libboost_signals-gcc41-mt.so
./opt/pdopensource/lib/libboost_filesystem-gcc41-mt-1_36.so.1.36.0
./opt/pdopensource/lib/libboost_filesystem-gcc41-mt-1_36.a
./opt/pdopensource/lib/libboost_system-gcc41-mt.a
./opt/pdopensource/lib/libboost_thread-gcc41-mt.a
./opt/pdopensource/lib/libboost_signals-gcc41-mt-1_36.so
./lib/libgcc_s.so.1
./lib64/libgcc_s.so.1
./usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/linux/compiler-gcc3.ph
./usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/linux/compiler-gcc.ph
./usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/linux/compiler-gcc4.ph
./usr/lib/gcc
./usr/lib/gcc/i586-suse-linux/2.95.3/libgcc.a
./usr/lib64/gcc
./usr/share/zsh/4.2.6/functions/_gcc
./usr/openv/tmp/jre_old/plugin/i386/ns610-gcc32
./usr/openv/java/jre/lib/i386/libjavaplugin_nscp_gcc29.so
./usr/openv/java/jre/plugin/i386/ns7-gcc29





And that's all ... Can anybody help me?


Thanks in advance!!!

Last edited by pludi; 11-17-2010 at 05:14 AM.. Reason: code tags, please...
# 2  
Old 11-16-2010
Umm looks like a problem with gcc

Try compiling this simple test c program (save as magius.c):
Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    char testvar[255];
    strcpy(testvar, "Hello, Magius");
    printf("%s\n", testvar);
    return 1;
}

Comile it with
Code:
cc -o magius magius.c

# 3  
Old 11-17-2010
Hi!

Thanks for your reply Chubler_XL.

It looks just what you said: a problem with gcc. I create the file:

Code:
/bin/magius/shc-3.8.6 # echo "#include <stdio.h>
> #include <string.h>
> int main(int argc, char *argv[])
> {
>     char testvar[255];
>     strcpy(testvar, "Hello, Magius");
>     printf("%s\n", testvar);
>     return 1;
> }" > magius.c

And then I compile it with the instruction given:

Code:
/bin/magius/shc-3.8.6 # cc -o magius magius.c
magius.c:1:19: error: stdio.h: No such file or directory
magius.c:2:20: error: string.h: No such file or directory
 main
magius.c: In function âmainâ:
magius.c:6: warning: incompatible implicit declaration of built-in function âstrcpyâ
magius.c:6: error: âHelloâ undeclared (first use in this function)
magius.c:6: error: (Each undeclared identifier is reported only once
magius.c:6: error: for each function it appears in.)
magius.c:6: error: âMagiusâ undeclared (first use in this function)
magius.c:6: error: too many arguments to function âstrcpyâ
magius.c:7: warning: incompatible implicit declaration of built-in function âprintfâ
magius.c:7: error: expected expression before â%â token

Execution times (seconds)
 preprocessing         :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (13%) wall       0 kB ( 0%) ggc
 parser                :   0.01 (100%) usr   0.00 ( 0%) sys   0.01 (12%) wall      70 kB ( 4%) ggc
 TOTAL                 :   0.01             0.00             0.08               1824 kB
/bin/magius/shc-3.8.6 #


I don't know anything about gcc or compile nothing (many years had passed from the university...) but the error shows missing files. I tried to find it, but the aren't in any FS of the server:

Code:
/bin/magius/shc-3.8.6 # cd /
/ # find ./ -name stdio.h -print
/ #

/ # find ./ -name string.h -print
/ #


Where should it be? I do not install the server, so I don't know anything about the packages or anything... Must I install anything on it?


Thanks, again, for the help!


Best regards...

Moderator's Comments:
Mod Comment Please use [CODE][/CODE] tags for listings and terminal output


---------- Post updated at 01:06 PM ---------- Previous update was at 10:02 AM ----------

Sorry for the unused tags CODE :-S

I've been searching more ... I don't knew "yast" to install software, so I try it:

Remember I do NOT install the server, so I don't know what are really installed on it.

Anyway, looking in yast -> Software -> Software Management -> Shearch -> gcc I see this:
Code:
|     |Name        |Avail. Vers.  |Inst. Vers.   |Summary                                    |Size       
|  i  |cpp         |4.1.2_20070115|4.1.2_20070115|The GCC Preprocessor                       |5.6 M
|  +  |gcc         |4.1.2_20070115|              |The GNU C Compiler and Support Files       |1.8 M
|  +  |gcc-c++     |4.1.2_20070115|              |The GNU C++ Compiler                       |6.3 M
|     |gcc-fortran |4.1.2_20070115|              |The GNU Fortran Compiler and Support Files |8.0 M
|     |gcc-info    |4.1.2_20070115|              |GNU Info-Pages for GCC                     |1.4 M
|     |gcc-java    |4.1.2_20070115|              |The GNU Java Compiler                      |5.9 M
|  +  |gcc-locale  |4.1.2_20070115|              |Locale Data for the GNU Compiler Collection|4.9 M
|  +  |gcc-obj-c++ |4.1.2_20070115|              |GNU Objective C++ Compiler                 |6.1 M
|  +  |gcc-objc    |4.1.2_20070115|              |GNU Objective C Compiler                   |6.0 M
|  i  |libgcc      |4.1.2_20070115|4.1.2_20070115|C compiler runtime library                 |98.6 K
|     |libgcj      |4.1.2_20070115|              |Java Runtime Library for gcc               |38.9 M
|     |libgcj-32bit|4.1.2_20070115|              |Java Runtime Library for gcc               |21.4 M

So, I understand that GCC isn't really installed in the server, rigth? I try to install it (tells me something about some necesary changes in the package versions) but finally it said I must insert the 'SUSE Linux Enterprise Server 10 SP2 CD 1' and the 'SUSE Linux Enterprise Server 10 SP2 CD 2' to install it.

I do NOT have it, I just want to install it from the network, from any software repository over the internet (opensuse.org or elsewhere)...

Can you helpme? Thanks in advance!!!

Last edited by pludi; 11-17-2010 at 05:16 AM..
# 4  
Old 11-17-2010
Your on the the right track, I know if you download the SUSE 64 bit RPMs of gcc you can right click and install with Yast but this won't sort out and fetch the dependancies for you.

I've never used SUSE Linux, so can't help with configuring the network install of Yast. You are probably best off starting a new thread in the Linux Forum, the gurus over there will get this sorted for you much quicker.
# 5  
Old 11-17-2010
Thanks again Chubler_XL :-)

I'll post in the Linux Forum, but before I wish to thank you again for the answers and for your time.


If I ever can do anything for you, just let me know...


Best Regards...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

shc utility for background jobs

I have used shc utillity to convert a shell script to it's compiled version.Inside this script i have called another shell script which is also in compled version. Example:- Main script:- main.sh.x child script:- child.sh.x (this is called inside main.sh.x) This child script will run in... (2 Replies)
Discussion started by: millan
2 Replies

2. UNIX for Dummies Questions & Answers

Shc on SUN 5.10 SPARC

Hello, I would like to use shc on SUN 5.10 SPARC and HP UX Itanium 11.31 so that I could do some encrypting on my shell scripts. But on these machines I don"t have cc or gcc. I find a man who can download shc.c and send me the binary files. You can download it here : www datsi fi upm es... (3 Replies)
Discussion started by: peg
3 Replies

3. Shell Programming and Scripting

SHC Cron help-me

Hello, I have some shellscripts internal company more by the need to conceal the code to protect passwords and others, we are using the SHC. the shellscripts always worked without error, including cron. after the SHC, if I run manually (. / shellscript) it works if I put the same command... (3 Replies)
Discussion started by: c0i0t3
3 Replies

4. Shell Programming and Scripting

shc compiler issue

I am using the shc shell compiler, it works fine, just that when i execute it, it displays the code at the terminal. Is there any way to hide this as well? otherwise it beats the purpose of hiding the code. Thanks ! (7 Replies)
Discussion started by: ysvsr1
7 Replies

5. Shell Programming and Scripting

Need help - shc

I have two scripts test1.sh and test2.sh. test1.sh is calling test2.sh. test2.sh is having some functions and password which we are using in test1.sh test1.sh #!/bin/sh . test2.sh echo "$test"test2.sh #!/bin/sh test=pravinO/P pravin Now use shc to protect my test2.sh and i modified... (5 Replies)
Discussion started by: pravin27
5 Replies

6. Shell Programming and Scripting

Help with shc

Hi all, I'm trying to install shc on my clean solaris 10 so that I could do some encrypting on my shell scripts. I've tried several ways but it gave me these error messages # make cc -Wall -O6 shc.c -o shc cc: illegal option -Wall *** Error code 1 make: Fatal error: Command failed... (6 Replies)
Discussion started by: solarisnoob
6 Replies

7. Shell Programming and Scripting

SHC Compiler [ERROR] AIX

Hello there, I’m compiling a shell script under UNIX AIX 5.3 operating system. I’m facing a “glitch” when I tried to run the .x file AIX sent the error message “Killed”. # rpm -qa libgcc-4.2.0-3 libstdc++-4.2.0-3 gcc-4.2.0-3 libstdc++-devel-4.2.0-3 gcc-c++-4.2.0-3 # make *** ... (2 Replies)
Discussion started by: micrinho
2 Replies

8. Programming

How to call the c library created by shc

I have written a shell script called square, which prints the square of the input number, eg. > square 4 16 There is a program called shc which compiles the shell scirpt and create a executable file and a c library file, namely square.x and square.x.c repectively. If I would like to... (1 Reply)
Discussion started by: alfredo
1 Replies

9. Shell Programming and Scripting

How to call the c library created by shc

I have written a shell script called square, which prints the square of the input number, eg. > square 4 16 There is a program called shc which compiles the shell scirpt and create a executable file and a c library file, namely square.x and square.x.c repectively. If I would like to... (0 Replies)
Discussion started by: alfredo
0 Replies

10. Shell Programming and Scripting

shc: shell compiler?

Has anyone ever gotten shc compiler program to work. I am trying to encrypt a bash script on centos. When I run the command "shc -f test.sh", the binary actually gets created; however, when I try to run the binary I get the following the error: # ./test.sh.x ./test.sh.x: No such file or... (1 Reply)
Discussion started by: cstovall
1 Replies
Login or Register to Ask a Question