forked from neurobin/shc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request neurobin#70 from mathieu-aubin/master
Master
- Loading branch information
Showing
5 changed files
with
108 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
src/.deps | ||
src/shc | ||
src/shc.o | ||
*Makefile | ||
config.status | ||
/build | ||
/autom4te.cache | ||
*.scan | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,55 +4,36 @@ | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="Content-Style-Type" content="text/css" /> | ||
<meta name="generator" content="pandoc" /> | ||
<meta name="author" content="" /> | ||
<meta name="date" content="2018-11-20" /> | ||
<meta name="date" content="2019-01-14" /> | ||
<title>shc(1) shc user manual</title> | ||
<style type="text/css">code{white-space: pre;}</style> | ||
<style type="text/css"> | ||
div.sourceCode { overflow-x: auto; } | ||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { | ||
margin: 0; padding: 0; vertical-align: baseline; border: none; } | ||
table.sourceCode { width: 100%; line-height: 100%; } | ||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } | ||
td.sourceCode { padding-left: 5px; } | ||
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */ | ||
code > span.dt { color: #902000; } /* DataType */ | ||
code > span.dv { color: #40a070; } /* DecVal */ | ||
code > span.bn { color: #40a070; } /* BaseN */ | ||
code > span.fl { color: #40a070; } /* Float */ | ||
code > span.ch { color: #4070a0; } /* Char */ | ||
code > span.st { color: #4070a0; } /* String */ | ||
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */ | ||
code > span.ot { color: #007020; } /* Other */ | ||
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */ | ||
code > span.fu { color: #06287e; } /* Function */ | ||
code > span.er { color: #ff0000; font-weight: bold; } /* Error */ | ||
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ | ||
code > span.cn { color: #880000; } /* Constant */ | ||
code > span.sc { color: #4070a0; } /* SpecialChar */ | ||
code > span.vs { color: #4070a0; } /* VerbatimString */ | ||
code > span.ss { color: #bb6688; } /* SpecialString */ | ||
code > span.im { } /* Import */ | ||
code > span.va { color: #19177c; } /* Variable */ | ||
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ | ||
code > span.op { color: #666666; } /* Operator */ | ||
code > span.bu { } /* BuiltIn */ | ||
code > span.ex { } /* Extension */ | ||
code > span.pp { color: #bc7a00; } /* Preprocessor */ | ||
code > span.at { color: #7d9029; } /* Attribute */ | ||
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */ | ||
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ | ||
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ | ||
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ | ||
code > span.kw { color: #007020; font-weight: bold; } | ||
code > span.dt { color: #902000; } | ||
code > span.dv { color: #40a070; } | ||
code > span.bn { color: #40a070; } | ||
code > span.fl { color: #40a070; } | ||
code > span.ch { color: #4070a0; } | ||
code > span.st { color: #4070a0; } | ||
code > span.co { color: #60a0b0; font-style: italic; } | ||
code > span.ot { color: #007020; } | ||
code > span.al { color: #ff0000; font-weight: bold; } | ||
code > span.fu { color: #06287e; } | ||
code > span.er { color: #ff0000; font-weight: bold; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<h1 class="title">shc(1) shc user manual</h1> | ||
<h2 class="author"></h2> | ||
<h3 class="date">November 20, 2018</h3> | ||
<h3 class="date">January 14, 2019</h3> | ||
</div> | ||
<hr> | ||
|
||
<h1 id="name">NAME</h1> | ||
<p>shc - Generic shell script compiler</p> | ||
<h1 id="synopsis">SYNOPSIS</h1> | ||
|
@@ -66,87 +47,51 @@ <h1 id="description">DESCRIPTION</h1> | |
<p><strong>shc</strong> 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 <code>-c</code> option. Unfortunatelly, it will not give you any speed improvement as a real C program would.</p> | ||
<p><strong>shc</strong>'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.</p> | ||
<h1 id="options">OPTIONS</h1> | ||
<dl> | ||
<dt>-e <em>date</em></dt> | ||
<dd>Expiration date in <em>dd/mm/yyyy</em> format <code>[none]</code> | ||
</dd> | ||
<dt>-m <em>message</em></dt> | ||
<dd>message to display upon expiration <code>["Please contact your provider"]</code> | ||
</dd> | ||
<dt>-f <em>script_name</em></dt> | ||
<dd>File path of the script to compile | ||
</dd> | ||
<dt>-i <em>inline_option</em></dt> | ||
<dd>Inline option for the shell interpreter i.e: <code>-e</code> | ||
</dd> | ||
<dt>-x <em>command</em></dt> | ||
<dd>eXec command, as a printf format i.e: <code>exec(\\'%s\\',@ARGV);</code> | ||
</dd> | ||
<dt>-l <em>last_option</em></dt> | ||
<dd>Last shell option i.e: <code>--</code> | ||
</dd> | ||
<dt>-o <em>outfile</em></dt> | ||
<dd>output to the file specified by outfile | ||
</dd> | ||
<dt>-r</dt> | ||
<dd>Relax security. Make a redistributable binary which executes on different systems running the same operating system. You can release your binary with this option for others to use | ||
</dd> | ||
<dt>-v</dt> | ||
<dd>Verbose compilation | ||
</dd> | ||
<dt>-S</dt> | ||
<dd>Switch ON setuid for root callable programs [OFF] | ||
</dd> | ||
<dt>-D</dt> | ||
<dd>Switch on debug exec calls | ||
</dd> | ||
<dt>-U</dt> | ||
<dd>Make binary to be untraceable (using <em>strace</em>, <em>ptrace</em>, <em>truss</em>, etc.) | ||
</dd> | ||
<dt>-H</dt> | ||
<dd>Hardening. Extra security flag without root access requirement that protects against dumping, code injection, <code>cat /proc/pid/cmdline</code>, ptrace, etc.. This feature is <strong>experimental</strong> and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters. | ||
</dd> | ||
<dt>-s</dt> | ||
<dd>Hardening with single process. Requires -H option, runs the binary in a single process, shell is called in the main process otherwise its called in a child process. This feature is <strong>experimental</strong> (may hang) and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters. | ||
</dd> | ||
<dt>-C</dt> | ||
<dd>Display license and exit | ||
</dd> | ||
<dt>-A</dt> | ||
<dd>Display abstract and exit | ||
</dd> | ||
<dt>-B</dt> | ||
<dd>Compile for BusyBox | ||
</dd> | ||
<dt>-h</dt> | ||
<dd>Display help and exit | ||
</dd> | ||
</dl> | ||
<p>-e <em>date</em> : Expiration date in <em>dd/mm/yyyy</em> format <code>[none]</code></p> | ||
<p>-m <em>message</em> : message to display upon expiration <code>["Please contact your provider"]</code></p> | ||
<p>-f <em>script_name</em> : File path of the script to compile</p> | ||
<p>-i <em>inline_option</em> : Inline option for the shell interpreter i.e: <code>-e</code></p> | ||
<p>-x <em>command</em> : eXec command, as a printf format i.e: <code>exec(\\'%s\\',@ARGV);</code></p> | ||
<p>-l <em>last_option</em> : Last shell option i.e: <code>--</code></p> | ||
<p>-o <em>outfile</em> : output to the file specified by outfile</p> | ||
<p>-r : Relax security. Make a redistributable binary which executes on different systems running the same operating system. You can release your binary with this option for others to use</p> | ||
<p>-v : Verbose compilation</p> | ||
<p>-S : Switch ON setuid for root callable programs [OFF]</p> | ||
<p>-D : Switch on debug exec calls</p> | ||
<p>-U : Make binary to be untraceable (using <em>strace</em>, <em>ptrace</em>, <em>truss</em>, etc.)</p> | ||
<p>-H : Hardening. Extra security flag without root access requirement that protects against dumping, code injection, <code>cat /proc/pid/cmdline</code>, ptrace, etc.. This feature is <strong>experimental</strong> and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters.</p> | ||
<p>-s : Hardening with single process. Requires -H option, runs the binary in a single process, shell is called in the main process otherwise its called in a child process. This feature is <strong>experimental</strong> (may hang) and may not work on all systems. This option currently only works with Bourne shell (sh) scripts without any positional parameters.</p> | ||
<p>-C : Display license and exit</p> | ||
<p>-A : Display abstract and exit</p> | ||
<p>-B : Compile for BusyBox</p> | ||
<p>-h : Display help and exit</p> | ||
<h1 id="environment-variables">ENVIRONMENT VARIABLES</h1> | ||
<dl> | ||
<dt>CC</dt> | ||
<dd>C compiler command <code>[cc]</code> | ||
</dd> | ||
<dt>CFLAGS</dt> | ||
<dd>C compiler flags <code>[none]</code> | ||
</dd> | ||
<dt>LDFLAGS</dt> | ||
<dd>Linker flags <code>[none]</code> | ||
</dd> | ||
</dl> | ||
<p>CC : C compiler command <code>[cc]</code></p> | ||
<p>CFLAGS : C compiler flags <code>[none]</code></p> | ||
<p>LDFLAGS : Linker flags <code>[none]</code></p> | ||
<h1 id="examples">EXAMPLES</h1> | ||
<p>Compile a script which can be run on other systems with the trace option enabled (without <code>-U</code> flag):</p> | ||
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">shc</span> -f myscript -o mybinary</code></pre></div> | ||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">shc</span> -f myscript -o mybinary</code></pre> | ||
<p>Compile an untraceable binary:</p> | ||
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">shc</span> -Uf myscript -o mybinary</code></pre></div> | ||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">shc</span> -Uf myscript -o mybinary</code></pre> | ||
<p>Compile an untraceable binary that doesn't require root access (experimental):</p> | ||
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">shc</span> -Hf myscript -o mybinary</code></pre></div> | ||
<h1 id="bugs">BUGS</h1> | ||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">shc</span> -Hf myscript -o mybinary</code></pre> | ||
<h1 id="limitations">LIMITATIONS</h1> | ||
<p>The maximum size of the script that could be executed once compiled is limited by the operating system configuration parameter <code>_SC_ARG_MAX</code> (see sysconf(2))</p> | ||
<h1 id="authors">AUTHORS</h1> | ||
<p>Francisco Rosales <a href="mailto:[email protected]">[email protected]</a></p> | ||
<p>Md Jahidul Hamid <a href="mailto:[email protected]">[email protected]</a></p> | ||
<p>Francisco Rosales <script type="text/javascript"> | ||
<!-- | ||
h='fi.upm.es';a='@';n='frosal';e=n+a+h; | ||
document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>'); | ||
// --> | ||
</script><noscript>frosal at fi dot upm dot es</noscript></p> | ||
<p>Md Jahidul Hamid <script type="text/javascript"> | ||
<!-- | ||
h='yahoo.com';a='@';n='jahidulhamid';e=n+a+h; | ||
document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+e+'<\/'+'a'+'>'); | ||
// --> | ||
</script><noscript>jahidulhamid at yahoo dot com</noscript></p> | ||
<h1 id="report-bugs-to">REPORT BUGS TO</h1> | ||
<p><a href="https://github.com/neurobin/shc/issues" class="uri">https://github.com/neurobin/shc/issues</a></p> | ||
<p><a href="https://github.com/neurobin/shc/issues">https://github.com/neurobin/shc/issues</a></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.