Wednesday, August 15, 2012

How to secure/encrypt the shell script.!

If you wanted to encrypt the shell script, Or you need to do secure the shell script. Please use this tool.

Install with (binary) source.
# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz
# tar xvfz shc-3.8.7.tgz
# cd shc-3.8.7
# make

Or
Install with Yum repository.

yum install shc -y

Run the script with sevral options.

$ ./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



Create the test shell script.
--------------------------
#! /bin/bash

echo " Hey Hello.!"

--------------------------
If installed with yum please do this

$ shc -f filename.sh
After run this command you will find two more file with the name as follows.
Original file : filename.sh
C compile file : filename.x.c
Encripted File: filename.x

And if you run the command like:

$./filename.x
o/p: Hey Hello.!

1 comments:

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city