繁体   English   中英

在动态解码base64编码的shell脚本并执行时如何传递参数

[英]how to pass the argument, when dynamically decoding a base64 encoded shell script, and executing

我有一个剧本

test.sh:

#!/bin/bash
echo "Script is executed"
echo "Input argument for this script is $1"
password="xyz"

如果执行脚本,我将得到

./test.sh你好

脚本执行
该脚本的输入参数是hello

由于脚本中包含密码,因此我决定使用base64对其进行编码

base64 test.sh> o

为了执行脚本,我正在使用(将混淆后的输出解码为输入并执行)

base64 -do | SH

输出是

脚本执行
该脚本的输入参数是

我的问题是,如何将“ hello”参数传递给此执行方法“ base64 -do | sh”

如果我尝试这个,我会

$ base64 -do | 你好
sh:你好:没有这样的文件或目录

注意:我无法从文件传递参数,因为它是用户动态键入的。

尝试这个:

base64 -d o | sh -s hello

您可以使用此:

base64 -do | sh -s hello

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM