📜 ⬆️ ⬇️

Hiding bash scripts

Very often freelancing happens, so the customer asks to do some work, having received a test version, accepts it and refuses to pay
I often do freelance scripts for the order, server administration, etc., automation of certain processes on the server, catching the basic idea of ​​writing, as a rule, the customer disappears, having decided that it is all so simple and there is nothing to pay for.
Faced with the concept of Obfuscation in C, I decided to look for a similar solution for my beloved Bash.

Developer someone Francisco Javier Rosales GarcĂ­a

The solution is called shc - Bash to C translator

Of the options especially liked
-e date
Expiration date in dd/mm/yyyy format [none]
-m message
message to display upon expiration ["Please contact
your provider"]

')
You can download the source code at www.datsi.fi.upm.es/~frosal

Work example:

1) Let's create the simplest Bash script test.sh

 #!/bin/bash echo "Hello WORD" #  a=$1 #   echo $a #   


Check
 sh test.sh test Hello WORD test 


2) Run shc and perform the conversion
 [user@server shc-3.8.7]$ ./shc -v -r -T -f test.sh 


3) At the output we get
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc test.sh.xc -o test.sh.x
shc: strip test.sh.x
shc: chmod go-r test.sh.x


4) Verification
./test.sh.x test
Hello WORD
test

Now in order

The test.sh.xc file is created - the almost unreadable contents of the Cishny code; you can compile it at any time manually using the cc compiler.

The second file test.sh.x is already binary, runs on virtually any Linux, checked on 5 (Gentoo, RHEL, Debian, ALT, OpenSuSE)

There is no need to talk about performance, since this is irrelevant, scripts are written for other tasks.

Source: https://habr.com/ru/post/139666/


All Articles