shc-3.9/shc.html
2019-11-02 19:09:10 +00:00

182 lines
4.4 KiB
HTML

Content-type: text/html
<HTML><HEAD><TITLE>Manpage of shc</TITLE>
</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>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
shc - Generic shell script compiler
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>shc</B>
[ -<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>
<B>shc</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>
The maximum size of the script that could be executed once compiled is limited
by the operating system configuration parameter
<B>_SC_ARG_MAX</B>
(see
<B>sysconf</B>(<B>2</B>))
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHOR</H2>
Alexander Mx
&lt;<A HREF="mailto:frosal@fi.upm.es">frosal@fi.upm.es</A>&gt;
<A NAME="lbAJ">&nbsp;</A>
<H2>REPORT BUGS TO</H2>
the author.
<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>
</HTML>