Issue
I have a bash script which I need to encrypt(Run the script without anybody seeing the code.).
I have tried encrypting with command openssl enc -e -aes-256-cbc -a -in test.sh > testing
.
I can execute the script with command:
openssl enc -e -aes-256-cbc -a -in testing -pass pass:<password> | sh -
But my script needs arguments as well, how to pass arguments to the encrypted script?
Original execution method: sh test.sh 1 a 23
How to execute encrypted script with arguments "1 a 23"?
Any help would be appreciated. Thanks in advance.
Solution
You can explicitly tell sh
to read the commands from stdin, and the specify the arguments:
openssl ... | sh -s 1 a 23
Answered By - user1934428 Answer Checked By - Senaida (WPSolving Volunteer)