Bash Script Encryption

  • Views Views: 186
  • Last updated Last updated:
  • Bash Script Encryption with SHC

    This is a quick guide to protect your bash script from being viewed and modified by other people!

    Note: This method only protects your script from the so-called "skids" - people who don't really know what they are doing. If the person is somewhat knowledgable, he/she can still easily decrypt it and view the source.

    Step 1: Install SHC

    On Ubuntu:
    Code:
    sudo add-apt-repository -y ppa:neurobin/ppa
    sudo apt-get -y update
    sudo apt-get -y install shc
    On other Linux Distributions:
    Code:
    git clone https://github.com/neurobin/shc
    cd shc
    ./autogen.sh
    ./configure
    make
    sudo make install

    Step 2: Understand the tags

    -v: verbose
    -r: relaxed security
    -U: untraceable binary
    -H: hardened security
    -s: run in a single process (requires the -H tag)
    -e: expiration date (dd/mm/yyyy)
    -m: expiration message

    Step 3: Create a redistributable script

    Generally, you would want to have the relaxed security so that the script to run on other Linux Operating System.
    Code:
    shc -v -r -f script.sh
    You can also add an expiration date:
    Code:
    shc -v -r -e 31/12/2019 -f script.sh
    ... and even expiration message:
    Code:
    shc -v -r -e 31/12/2019 -m "Script expired. Please contact TommyTran732" -f script.sh
  • Loading…