执行使用openssl enc加密的bash脚本

问题描述 投票:0回答:1

我有一个需要加密的 bash 脚本(在没有人看到代码的情况下运行脚本。)。

我尝试过使用命令加密

openssl enc -e -aes-256-cbc -a -in test.sh > testing

我可以使用命令执行脚本:

openssl enc -e -aes-256-cbc -a -in testing -pass pass:<password> | sh -

但是我的脚本也需要参数,如何将参数传递给加密脚本?

原执行方法:

sh test.sh 1 a 23

如何使用参数“1 a 23”执行加密脚本?

如有任何帮助,我们将不胜感激。预先感谢。

bash shell encryption openssl sh
1个回答
0
投票

您可以明确告诉

sh
从 stdin 读取命令,并指定参数:

openssl ... | sh -s 1 a 23
© www.soinside.com 2019 - 2024. All rights reserved.