Convert a shell script into an executable binary

Convert a shell script into an executable binary


This article will help you to create binary file of your shell script, so no one can see the source code of your script and we can use them as a command.

To create binary file from a script we use SHC compiler written by Francisco Javier Rosales García.

Shell Script Compiler (SHC)

1. Download shc and install it

$ wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz
$ tar xvfz shc-3.8.7.tgz
$ cd shc-3.8.7
$ make

2. Verify that shc is installed properly.

$ ./shc -v
shc parse(-f): No source file specified

shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script

3. Create a Sample Shell Script

$ vi test.sh

#!/bin/bash need to put at the beginning of a script file.

#!/bin/bash
echo -n "Test"

4. Create Binary of Script

$ ./shc -T -f test.sh

-T : this will allow the created binary files to be traceable using programs like strace, ltrace, etc.
-f : file name.

This will create the following files:

$ ls -l test.sh*
-rwxrw-r--. 1 cyb cyb   149 Oct 28 15:09 test.sh
-rwx-wx--x. 1 cyb cyb 11752 Oct 28 15:12 test.sh.x
-rw-rw-r--. 1 cyb cyb 10174 Oct 28 15:12 test.sh.x.c

$ file random.sh
test.sh: Bourne-Again shell script text executable

$ file random.sh.x
test.sh.x: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

$ file random.sh.x.c
test.sh.x.c: ASCII C program text

References

Comments

  1. It’s an outside shot, however the likelihood to win tons of of thousands of cash via roulette is actual. The greatest roulette site delivers a unbelievable participant experience, provides lucrative bonuses and the most important payouts. To discover out which on line casino we’ve ranked high for this month a glance at|try} our toplist. We fee the casinos that supply roulette players one of the best value, with as small a reduce as potential going to the on line casino from your wager. Any top-rated roulette on line casino on-line will offer competitive payout percentages with 메리트카지노 one of the best return to participant out there, so find a way to|you possibly can} enjoy great odds if you play. In your play cash bankroll, you win 35 times your unique bet should you get the quantity right on a single quantity bet.

    ReplyDelete

Post a Comment

Popular posts from this blog

Understanding htop value

Mac terminal environment setup - zsh + Powerline + tmux