Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.
It sounds a bit cheesy but I can't find any usable solution on how to encrypt Linux/Unix shell script in order to protect it’s source code when it’s still executable.
There was a post here about how to protect shell scripts, but I found SHC bug. Just run script that is encrypted with shc and execute command ps ax and you'll see full source code at ps’s output (newline characters will be replaced with "?" symbol). Because of this fact I can't use SHC anymore and looking for alternative solution.
It would be very appreciated if you suggest a way how to solve the issue. THANK YOU, mates.
Please follow up with this thread on linuxforums.org.
Share This
Here is one more way to find out how many CPUs are used by Linux:
cat /proc/cpuinfo | grep "^vendor_id" | wc -l
As for me I use this way to make sure that SMP kernel should be installed.
You're welcome to suggest your ways of doing the same in comments. Thank you in advance!
Share This
Here is a shell script example that can be run by cron for automatic killing of "zombie" processes in Linux system:
zombies.sh
Share This
In order to change shell for a particular user of Unix/Linux system without editing /etc/passwd file manually just use command:
chsh -s /path/to/shell username
for example, to change shell to ’sh' from 'bash' for user 'viper', use command:
chsh -s /bin/sh viper
Share This
I usually encrypt files with GPG with symmetric algorithms when I have to transmit files over insecure channel: for example I encrypt backup files stored at my USB stick and I'm sure that if it’s stolen or lost my files are in safety.
Encryption without user intervention can be used when you wish to perform automatic (runs with cron) backup procedure and protect backup files.
To encrypt file /tmp/file.tgz by symmetric AES algorithm (256 is a key lenght) with one command please use the following command:
echo password | gpg --batch -q --passphrase-fd 0 --cipher-algo AES256 -c /tmp/file.tgz
Previous command will create file.tgz.gpg that can be extracted automatically by next one:
echo password | gpg --batch -q -o /tmp/file.tgz --passphrase-fd 0 --decrypt /tmp/file.tgz.gpg
Share This
One day it came to my mind that bash scripts I was developing for a long time (approximately 5000 lines) should be encrypted in order not to be viewed by everyone…
Thanks to heaven there is utility written by Francisco Javier Rosales García SHC that allows to create a stripped binary executable version of the script.
This utility is included into many Linux distributions' repositories (I've used it in Ubuntu and Fedora). To use it in Ubuntu (my laptop operating system) just install it by commands:
apt-get install shc
apt-get install build-essential
The second command installs dependencies for SHC. On my Ubuntu Feisty they weren't installed automatically during SHC installation and I've got errors when compile scripts with SHC (that’s why I've installed them explicitly).
When necessary packages are installed compile some script with command:
shc -f script.sh
This command will create script.sh.x which can be run as a regular binary and is encrypted. Moreover this executable can be started only on the machine it’s compiled at (of course until you've compiled it with 'relax security' option -r).
This utility is also useful to create demo version binaries: it’s possible to set expiration date for the binary.
Respect to the author!
Share This
Recent Ideas