From: Scott Worley Date: Sun, 22 Oct 2017 04:01:53 +0000 (-0700) Subject: Add an operation field to each line. X-Git-Url: http://git.scottworley.com/overonion/commitdiff_plain/fa1362a5c2ae8208e56ffc7555bbe8903831e70e?ds=sidebyside Add an operation field to each line. The only operation at first is "openssl-enc" --- diff --git a/overonion b/overonion index a33351a..271938c 100755 --- a/overonion +++ b/overonion @@ -40,9 +40,14 @@ function go() { if (( layer == 0 || layer > num_layers ));then cat else - openssl enc $openssl_decrypt "-$(sed -n "${layer}s/ .*//p" "$keyfile")" \ - -pass fd:37 37< <(sed -n "${layer}s/^[^ ]* //p" "$keyfile") | - go $(( layer + next_layer )) + operation=$(sed -n "${layer}s/ .*//p" "$keyfile") + if [[ "$operation" == openssl-enc ]];then + openssl enc $openssl_decrypt "-$(sed -rn "${layer}s/[^ ]+ ([^ ]+) .*/\\1/p" "$keyfile")" \ + -pass fd:37 37< <(sed -rn "${layer}s/^[^ ]+ [^ ]+ //p" "$keyfile") + else + die "Unknown operation" + fi | + go $(( layer + next_layer )) fi } diff --git a/overonion-make-key b/overonion-make-key index da564ad..ff09472 100755 --- a/overonion-make-key +++ b/overonion-make-key @@ -36,6 +36,6 @@ fi i=0 while read -r cipher;do echo -n $'\r'"Generating key $((++i))/${#ciphers[*]}" >&2 - cat >> "$keyfile" <<< "$cipher $(head -c 99 "$random_source" | base64 --wrap=0 )" + cat >> "$keyfile" <<< "openssl-enc $cipher $(head -c 99 "$random_source" | base64 --wrap=0 )" done < <( IFS=$'\n'; shuf <<< "${ciphers[*]}"; ) echo >&2