Commit 9f5c41e1 authored by Alex Yustasov's avatar Alex Yustasov Committed by Automatic Converter

3.8.3-alt1

- 3.8.3
parent d887af54
Name: shc Name: shc
Version: 3.7 Version: 3.8.3
Release: alt1 Release: alt1
Summary: Generic shell script compiler Summary: Generic shell script compiler
...@@ -13,6 +13,8 @@ Source0: %name-%version.tgz ...@@ -13,6 +13,8 @@ Source0: %name-%version.tgz
Patch0: %name-3.7-makefile.patch Patch0: %name-3.7-makefile.patch
Requires: gcc
%description %description
A generic shell script compiler. shc takes a script, which is A generic shell script compiler. shc takes a script, which is
specified on the command line and produces C source code. The specified on the command line and produces C source code. The
...@@ -36,5 +38,8 @@ stripped binary executable. Use with care. ...@@ -36,5 +38,8 @@ stripped binary executable. Use with care.
%_mandir/man?/* %_mandir/man?/*
%changelog %changelog
* Mon Jul 18 2005 Alex Yustasov <yust@altlinux.ru> 3.8.3-alt1
- 3.8.3
* Wed Jan 26 2005 Alex Yustasov <yust@altlinux.ru> 3.7-alt1 * Wed Jan 26 2005 Alex Yustasov <yust@altlinux.ru> 3.7-alt1
- initial release - initial release
CHANGES CHANGES
3.8.3 Tue Jun 28 21:29:06 CEST 2005
Thanks to Jacek Kalinski <jacek@dyski.one.pl> for:
- Fixed bug: "vfork" fails on multiprocessor systems.
3.8.2 Thu Jun 16 17:15:59 CEST 2005
Thanks to Arjen Visser <arjen.visser@avisit.co.nz> for:
- Fixed bug: "rlax" used after encryption.
Thanks to Nalneesh Gaur <Nalneesh.Gaur@accenture.com> for:
- Read permision of the script.x exposes it to disassembling.
- Group and others read permision is now removed by default.
3.8 Thu Nov 4 20:33:52 CET 2004
Fixed incorrect implementation on rc4.
Hidden all the binary executable symbols but one.
Expiration date and most strings are encrypted too.
All the encrypted payload is now randomized.
3.7 Wed Jun 18 16:32:26 CEST 2003 3.7 Wed Jun 18 16:32:26 CEST 2003
Thanks to Philipp Koller <philipp@open.ch> for: Thanks to Philipp Koller <philipp@open.ch> for:
......
...@@ -26,7 +26,7 @@ SHELL = /bin/sh ...@@ -26,7 +26,7 @@ SHELL = /bin/sh
all: shc ask_for_test all: shc ask_for_test
shc: shc.c shc: shc.c
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $@.c -o $@
ask_for_test: ask_for_test:
@echo '*** Do you want to probe shc with a test script?' @echo '*** Do you want to probe shc with a test script?'
...@@ -39,12 +39,9 @@ make_the_test: match.x ...@@ -39,12 +39,9 @@ make_the_test: match.x
@echo '*** It must show files with substring "sh" in your PATH...' @echo '*** It must show files with substring "sh" in your PATH...'
./match.x sh ./match.x sh
match.x: match.x.c match.x: shc match
$(CC) $(CFLAGS) $< -o $@
match.x.c: shc match
@echo '*** Compiling script "match"' @echo '*** Compiling script "match"'
CFLAGS="$(CFLAGS)" ./shc -v -r -f match CFLAGS="$(CFLAGS)" ./shc -v -f match
ask_for_strings: ask_for_strings:
@echo '*** Do you want to see strings in the generated binary?' @echo '*** Do you want to see strings in the generated binary?'
...@@ -53,9 +50,9 @@ ask_for_strings: ...@@ -53,9 +50,9 @@ ask_for_strings:
strings: make_the_strings ask_for_install strings: make_the_strings ask_for_install
make_the_strings: match.x make_the_strings: match.x
@echo '*** Running: "strings -n 5 '$<'"' @echo '*** Running: "strings -n 5 'match.x'"'
@echo '*** It must show no sensible information...' @echo '*** It must show no sensible information...'
strings -n 5 $< strings -n 5 match.x
ask_for_install: ask_for_install:
@echo '*** Do you want to install shc?' @echo '*** Do you want to install shc?'
......
#
# sed script to wrapp C code as a C string.
#
# Duplicate unquoted %
s/[^\\]%/&%/g
#
# Unquote quoted %
s/\\%/%/g
#
# Duplicate \
s/\\/\\\\/g
#
# Quote "
s/"/\\"/g
#
# End each line with new-line
s/^.*$/&\\n/
#
# Enclose each line within "
s/^.*$/"&"/
#
#
# sed script to extract C code wrapped as a C string.
#
# Remove "s enclossing each line
s/^"\(.*\)"$/\1/
#
# Remove trailing new-line
s/^\(.*\)\\n$/\1/
#
# Unquote "
s/\\"/"/g
#
# Unduplicate \
s/\\\\/\\/g
#
# Quote unquoted and unduplicated %
s/\([^\\%]\)%\([^%]\)/\1\\%\2/g
#
# Unduplicate unquoted %
s/\([^\\]%\)%/\1/g
.TH shc 1 "Jun 18, 2003" "shc Version 3.7" .TH shc 1 "Jun 18, 2003" "shc Version 3.8"
.UC 4 .UC 4
.SH "NAME" .SH "NAME"
......
<HTML> Content-type: text/html
<HEAD>
<TITLE>shc(1)</TITLE>
<link rel=stylesheet type="text/css" href="/css/osix.css">
</HEAD>
<BODY>
<H1>Manpage for shc(1)</H1>
<PRE> <HTML><HEAD><TITLE>Manpage of shc</TITLE>
<!-- Manpage converted by man2html 3.0.1 --> </HEAD><BODY>
<H1>shc</H1>
Section: User Commands (1)<BR>Updated: Jun 18, 2003<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
</PRE>
<H2>NAME</H2><PRE>
shc - Generic shell script compiler
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
</PRE> shc - Generic shell script compiler
<H2>SYNOPSIS</H2><PRE> <A NAME="lbAC">&nbsp;</A>
shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ] <H2>SYNOPSIS</H2>
[ -l lopt ] [ -ACDhTv ] -f script
</PRE>
<H2>DESCRIPTION</H2><PRE>
shc creates a stripped binary executable version of the
script specified with -<I>f</I> on the command line.
The binary version will get a .<I>x</I> extension appended and will
usually be a bit larger in size than the original ascii
code. Generated C source code is saved in a file with the
extension .<I>x</I>.<I>c</I>
If you supply an expiration date with the -<I>e</I> option the com-
piled binary will refuse to run after the date specified.
The message "Please contact your provider" will be displayed
instead. This message can be changed with the -<I>m</I> option.
You can compile any kind of shell script, but you need to
supply valid -<I>i</I>, -<I>x</I> and -<I>l</I> options.
The compiled binary will still be dependent on the shell
specified in the first line of the shell code (i.e.
#!/bin/sh), thus shc does not create completely independent
binaries.
shc itself is not a compiler such as cc, it rather encodes
and encrypts a shell script and generates C source code with
the added expiration capability. It then uses the system
compiler to compile a stripped binary which behaves exactly
like the original script. Upon execution, the compiled
binary will decrypt and execute the code with the shell -<I>c</I>
option. Unfortunatelly, it will not give you any speed
improvement as a real C program would.
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.
</PRE>
<H2>OPTIONS</H2><PRE>
The command line options are:
-e date
Expiration date in dd/mm/yyyy format [none]
-m message
message to display upon expiration ["Please contact
your provider"]
-f script_name
File name of the script to compile
-i inline_option
Inline option for the shell interpreter i.e: -e
-x comand
eXec command, as a printf format i.e:
exec(\\'%s\\',@ARGV);
-l last_option
Last shell option i.e: --
-r Relax security. Make a redistributable binary which
executes on different systems running the same operat-
ing system.
-v Verbose compilation
-D Switch on debug exec calls
-T Allow binary to be traceable (using strace, ptrace,
truss, etc.)
-C Display license and exit
-A Display abstract and exit
-h Display help and exit
</PRE>
<H2>ENVIRONMENT VARIABLES</H2><PRE>
CC C compiler command [cc]
CFLAGS
C compiler flags [none]
</PRE> <B>shc</B>
<H2>EXAMPLES</H2><PRE>
Compile a script which can be run on other systems with the
trace option enabled:
example% shc -v -r -T -f myscript [ -<B>e</B> date ]
[ -<B>m</B> addr ]
[ -<B>i</B> iopt ]
[ -<B>x</B> cmnd ]
<BR>
[ -<B>l</B> lopt ]
[ -<B>ACDhTv</B> ]
-<B>f</B> script
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
</PRE> <B>shc</B>
<H2>BUGS</H2><PRE>
The maximum size of the script that could be executed once com­
piled is limited by the operating system configuration parameter
_SC_ARG_MAX (see <B>sysconf(2)</B>)
creates a stripped binary executable version of the script
specified with <I>-f</I> on the command line.
<P>
The binary version will get a <I>.x</I> extension appended
and will usually be a bit larger in size than the original ascii code.
Generated C source code is saved in a file with the extension <I>.x.c</I>
<P>
If you supply an expiration date with the <I>-e</I> option the
compiled binary will refuse to run after the date specified.
The message <B>&quot;Please contact your provider&quot;</B> will be displayed instead.
This message can be changed with the <I>-m</I> option.
<P>
You can compile any kind of shell script, but you need to supply valid
<I>-i</I>, <I>-x</I> and <I>-l</I> options.
<P>
The compiled binary will still be dependent on the shell specified
in the first line of the shell code (i.e. #!/bin/sh), thus <B>shc</B> does not create
completely independent binaries.
<P>
<B>shc</B> itself is not a compiler such as cc, it rather encodes and
encrypts a shell script and generates C source code with the added expiration
capability. It then uses the system compiler to compile a stripped binary
which behaves exactly like the original script. Upon execution, the compiled binary
will decrypt and execute the code with the shell <I>-c</I> option.
Unfortunatelly, it will not give you any speed improvement as a real C program would.
<P>
<B>shc</B>'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.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
The command line options are:
<DL COMPACT>
<DT><B>-e date</B>
<DD>
Expiration date in dd/mm/yyyy format [none]
<DT><B>-m message</B>
<DD>
message to display upon expiration [&quot;Please contact your provider&quot;]
<DT><B>-f script_name</B>
<DD>
File name of the script to compile
<DT><B>-i inline_option</B>
<DD>
Inline option for the shell interpreter i.e: -e
<DT><B>-x comand</B>
<DD>
eXec command, as a printf format i.e: exec(\\'%s\\',@ARGV);
<DT><B>-l last_option</B>
<DD>
Last shell option i.e: --
<DT><B>-r</B>
<DD>
Relax security. Make a redistributable binary which executes on
different systems running the same operating system.
<DT><B>-v</B>
<DD>
Verbose compilation
<DT><B>-D</B>
<DD>
Switch on debug exec calls
<DT><B>-T</B>
<DD>
Allow binary to be traceable (using strace, ptrace, truss, etc.)
<DT><B>-C</B>
<DD>
Display license and exit
<DT><B>-A</B>
<DD>
Display abstract and exit
<DT><B>-h</B>
<DD>
Display help and exit
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>ENVIRONMENT VARIABLES</H2>
<DL COMPACT>
<DT><B>CC</B>
<DD>
C compiler command [cc]
<DT><B>CFLAGS</B>
<DD>
C compiler flags [none]
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXAMPLES</H2>
<FONT SIZE="-1">Compile a script which can be run on other systems with the trace</FONT>
option enabled:
<P>
<BR>&nbsp;&nbsp;example%&nbsp;<B>shc</B>&nbsp;-v&nbsp;-r&nbsp;-T&nbsp;-f&nbsp;myscript
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>
</PRE> The maximum size of the script that could be executed once compiled is limited
<H2>AUTHOR</H2><PRE> by the operating system configuration parameter
Francisco Rosales &lt;frosal@fi.upm.es&gt; <B>_SC_ARG_MAX</B>
(see
<B>sysconf</B>(<B>2</B>))
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHOR</H2>
</PRE> Francisco Rosales
<H2>REPORT BUGS TO</H2><PRE> &lt;<A HREF="mailto:frosal@fi.upm.es">frosal@fi.upm.es</A>&gt;
the author. <A NAME="lbAJ">&nbsp;</A>
<H2>REPORT BUGS TO</H2>
</PRE> the author.
<P> <P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">OPTIONS</A><DD>
<DT><A HREF="#lbAF">ENVIRONMENT VARIABLES</A><DD>
<DT><A HREF="#lbAG">EXAMPLES</A><DD>
<DT><A HREF="#lbAH">BUGS</A><DD>
<DT><A HREF="#lbAI">AUTHOR</A><DD>
<DT><A HREF="#lbAJ">REPORT BUGS TO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 15:46:31 GMT, July 08, 2004
</BODY> </BODY>
</HTML> </HTML>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment