簡體   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