Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [[ ! -x $(which openssl) ]] ; then
- printf "Didn't find openssl binary. Can't encode rsdf container.\n"
- return 1
- fi
- containerOut="${containerDir}/${containerFileNameFormat}.rsdf"
- sed -n -e 's/^[^/]*\///p' "$1" > "${tmpdir}/links.txt"
- echo -n "" > "$containerOut"
- rm -f "${tmpdir}/in.step1" "${tmpdir}/in.step4"
- lc=0
- declare -a ll
- ll[0]=0
- while read ln ; do
- echo -n "CCF: $ln" >> "${tmpdir}/in.step1"
- lc=$(($lc+1))
- ll[$lc]=$(openssl enc -aes-192-cfb8 -K 8C35192D964DC3182C6F84F3252239EB4A320D2500000000 -iv A3D5A33CB95AC1F5CBDB1AD25CB0A7AA -in "${tmpdir}/in.step1" | wc -c)
- done < "${tmpdir}/links.txt"
- openssl enc -aes-192-cfb8 -K 8C35192D964DC3182C6F84F3252239EB4A320D2500000000 -iv A3D5A33CB95AC1F5CBDB1AD25CB0A7AA -in "${tmpdir}/in.step1" -out "${tmpdir}/in.step2"
- i=0
- while [[ $i -lt $lc ]] ; do
- laststart=${ll[$i]}
- i=$(($i+1))
- thisstart=${ll[$i]}
- let 'count = thisstart - laststart'
- dd bs=1 skip=$laststart count=$count if="${tmpdir}/in.step2" of="${tmpdir}/in.step3" 2>/dev/null
- openssl enc -base64 -in "${tmpdir}/in.step3" | tr -d '\n' >> "${tmpdir}/in.step4"
- echo -en "\n" >> "${tmpdir}/in.step4"
- done
- while read -n 1 byte ; do
- if [[ "X$byte" == "X" ]] ; then
- echo -n 0D0A
- else
- printf "%.2X" \'$byte
- fi
- done < "${tmpdir}/in.step4" > "$containerOut"
- echo -en "\r\n" >> "$containerOut"
- // rm -f "${tmpdir}/in.step1" "${tmpdir}/in.step2" "${tmpdir}/in.step3" "${tmpdir}/in.step4"
- return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement