Advertisement
howtophil

Retrieve encrypted file from PNG (2017/01/15)

Jan 15th, 2017
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 0 0
  1. #!/bin/bash
  2. #------------------------------------------------------------
  3. # To get file back from image
  4. #
  5. # $ ./fromcolor.sh imagefilename.png > restoredfile.name
  6. #
  7. # You will be prompted for your encryption key/passphrase
  8. #------------------------------------------------------------
  9. fabcounter=0
  10. declare -A fabcolors
  11. alphaarray=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
  12.  
  13. # Blues and purples theme
  14. colorarray=(000080 00008B 0000CD 0000FF 191970 1E90FF 4169E1 483D8B 4B0081 4B0182 6A5ACD 7B68EE 800080 8A2BE1 8A2CE2 8B008B 9370DB 9400D3 9932CC BA55D3 D8BFD8 DA70D6 DDA0DD E6E6FA EE82EE FF11FF FF00FF)
  15.  
  16. # Or dark greys to look black instead
  17. # colorarray=(000001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 000016 000017 000018 000019 000020 000021 000022 000023 000024 000025 000026)
  18.  
  19. for onecolor in "${colorarray[@]}"
  20. do
  21.     fabcolors["$onecolor"]="${alphaarray[$fabcounter]}"
  22.     let fabcounter+=1
  23. done
  24.  
  25. # while loop
  26. convert "$1" txt: | cut -f 2 -d'#' |cut -f 1 -d' ' | (
  27.     while IFS= read c
  28.     do
  29.         let counter+=1
  30.         if [[ " ${colorarray[@]} " =~ " ${c} " ]]; then
  31.             color=${fabcolors[$c]}
  32.             if [ $color ]; then
  33.                 echo -n $color
  34.             fi
  35.         fi
  36.     done
  37. ) | tr '.' " " | sed 's/.\{5\}/& /g' |codegroup -d |ccrypt -d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement