The encryption on this problem just got more interesting. I started with this script:

while read CTFlist; do 

#next we need to create ctfs padded with zeros as a variable
ctfPadded=(printf ${ctflist}00000000)

#then call rc2 key as variable

#next create a hex version of the rc2 key
hexRc2Key=$(printf "${rc2Key}"|xxd -p)

#next to create the encrypted ctf file using the hex rc2 key
ctfEnc= $(printf "${ctfPadded}" |xxd -r -p |openssl enc -rc2-cbc -nopad -K "${hexRc2Key}" -iv 0000000000000000 |xxd -plain|tr -d '\n')

#Now we call all our variables and output to a single file.
echo ${ctfPadded},${ctfEnc^^} >> output.csv

#calling end of file with the input file of ctflist.csv
done <CTFlist.csv

#have to change the output file to dos version or it wont open on a windows comp
unix2dos output.csv

The output.csv file has printf on every line down the list. Why? what is incorrect?

closed as off-topic by Kusalananda, Jeff Schaller, Thomas Dickey, GAD3R, G-Man Sep 4 '16 at 18:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Kusalananda, Jeff Schaller, Thomas Dickey, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.


You ommited a dollar sign in command substitution here:

ctfPadded=(printf ${ctflist}00000000)

This line should read:

ctfPadded=$(printf ${ctflist}00000000)
  • Thank you sometimes the smallest thing can be overlooked when moving too fast. I really appreciate your response, EXCELLENT Answer!! – DJLee Apr 27 '16 at 17:48
  • in the following commands the printf has been fixed but my output is the padded csv file and the encrypted output is showing "bash: 009bd5584e2e89aafbd42cb3316b39695c74d2e5371ae7de: command not found" in the terminal – DJLee Apr 27 '16 at 17:54
  • @DJLee I don't see how your script could result in such an error. Try putting echos in between lines to see which one generates it. – Alexander Batischev Apr 27 '16 at 18:23
  • There's no opkPadded in your original question. Anyway, I don't see how this can fail. Maybe factor it out into a number of variables and use echos to debug further? – Alexander Batischev Apr 27 '16 at 19:37
  • the error is following my apologies fast typing ctfEnc= $(printf "${ctfPadded}" |xxd -r -p |openssl enc -rc2-cbc -nopad -K "${hexRc2Key}" -iv 0000000000000000 |xxd -plain|tr -d '\n') – DJLee Apr 27 '16 at 19:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.