Is the bash script in the Prey project formatted incorrectly? Nested reverse problem?

I am a terrible newbie to bash scripts and I hope someone can help me with this problem.

There is a problem with the standalone scripts of the Prey project. There is a line that should send an email, and, apparently, is not formatted correctly.

response=`mailsender -f "$mail_from" -t "$mail_to" -u "$complete_subject" \
          -s $smtp_server -a $file_list -o message-file="$trace_file.msg" \
          tls=auto username=$smtp_username \
          password=\`decrypt \"$smtp_password\"\``

In cases where mailsender is an alias for the Brandon Zehm PERL sendEmail script, $ smtp_password is a meaningless base64 password encoding and is decrypted:

decrypt() {
    echo "$1" | openssl enc -base64 -d
}

So can someone tell me what happened to the script? For reference, if I just replace the entire decryption part with the plaintext password, it works fine. i.e:.

response=`mailsender -f "$mail_from" -t "$mail_to" -u "$complete_subject" \
          -s $smtp_server -a $file_list -o message-file="$trace_file.msg" \
          tls=auto username=$smtp_username password=actual_password`
0
source share
3 answers

- $() - , :

response=$(Documents/Projects/Shell\ Scripting/printargs -f "$mail_from" \
    -t "$mail_to" -u "$complete_subject" -s $smtp_server -a $file_list \
    -o message-file="$trace_file.msg"  tls=auto username=$smtp_username \
    password="$(decrypt "$smtp_password")")
+2

, script :

decrypt()
{
    echo "$1" | tr 'a-z' 'A-Z'
}
xxx=`echo xxx=yyy pass=\`decrypt \"xyz abc\"\``
echo "$xxx"

'sh -x xxx' ( "sh" - "bash" ):

$ sh -x xxx
+++ decrypt '"xyz' 'abc"'
+++ echo '"xyz'
+++ tr a-z A-Z
++ echo xxx=yyy 'pass="XYZ'
+ xxx='xxx=yyy pass="XYZ'
+ echo 'xxx=yyy pass="XYZ'
xxx=yyy pass="XYZ
$

, - , . decrypt , , , .

, script , decrypt, , , , , .

script, "$(...)", , :

decrypt()
{
    echo "$1" | tr 'a-z' 'A-Z'
}

yyy=$(echo zzz=yyy pass=$(decrypt "xyz abc"))
echo "$yyy"

:

$ sh -x xxx
+++ decrypt 'xyz abc'
+++ echo 'xyz abc'
+++ tr a-z A-Z
++ echo zzz=yyy pass=XYZ ABC
+ yyy='zzz=yyy pass=XYZ ABC'
+ echo 'zzz=yyy pass=XYZ ABC'
zzz=yyy pass=XYZ ABC
$
0

Prey. , .

, $() , - - , ( ).

Bash Skull, . , Prey 0.6 , $(), .

0

All Articles