howtophil icon

Retrieve encrypted file from PNG (color code by pixels)

howtophil | PRO | 12/22/16 05:04:05 PM UTC | 0 ⭐ | 777 👁️ | Never ⏰ | []
Bash |

1.35 KB

|

None

|

0 👍

/

0 👎

#!/bin/bash
#------------------------------------------------------------
# To get file back from image
#
# $ ./fromcolor.sh imagefilename.png > restoredfile.name
#
# You will be prompted for your encryption key/passphrase
# See matching tocolor.sh http://pastebin.com/jgXkjY78
#
# See update version of this script here http://pastebin.com/jCQMH5kW
#------------------------------------------------------------
 
# while loop
convert "$1" txt: | cut -f 2 -d'#' |cut -f 1 -d' ' | (
    while IFS= read c
    do
        let counter+=1 
        case "$c" in
            "000001") color="A" ;;
            "000002") color="B" ;;
            "000003") color="C" ;;
            "000004") color="D" ;;
            "000005") color="E" ;;
            "000006") color="F" ;;
            "000007") color="G" ;;
            "000008") color="H" ;;
            "000009") color="I" ;;
            "000010") color="J" ;;
            "000011") color="K" ;;
            "000012") color="L" ;;
            "000013") color="M" ;;
            "000014") color="N" ;;
            "000015") color="O" ;;
            "000016") color="P" ;;
            "000017") color="Q" ;;
            "000018") color="R" ;;
            "000019") color="S" ;;
            "000020") color="T" ;;
            "000021") color="U" ;;
            "000022") color="V" ;;
            "000023") color="W" ;;
            "000024") color="X" ;;
            "000025") color="Y" ;;
            "000026") color="Z" ;;
            "000027") color="." ;;
        esac
        if [ $color ]; then
            echo -n $color
        fi
    done 
) | tr '.' " " |codegroup -d |ccrypt -d

Comments