【发布时间】:2017-11-08 05:48:16
【问题描述】:
我有一个脚本
test.sh:
#!/bin/bash
echo "Script is executed"
echo "Input argument for this script is $1"
password="xyz"
如果我执行脚本,我会得到 p>
./test.sh 你好
脚本被执行
这个脚本的输入参数是hello
因为我在脚本中有密码,所以我决定用 base64 对其进行编码
base64 test.sh > o
为了执行脚本,我正在使用(将混淆后的输出解码为输入并执行)
base64 -d o |嘘
输出是
脚本被执行
这个脚本的输入参数是
我的问题是,如何将“hello”参数传递给这个执行方法“base64 -d o | sh”
如果我尝试这个,我会得到
$ base64 -d o | sh hello
sh: hello: 没有这样的文件或目录
注意:我无法从文件中传递参数,因为它是由用户动态键入的。
【问题讨论】:
-
可以使用临时文件吗? base64 -d o > tmp.file && sh tmp.file 你好 && rm tmp.file
标签: linux shell unix base64 pipe