Advertisement
howtophil

Encrypted files stored as PDF of QRcodes (phone scannable)

Dec 21st, 2016
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.15 KB | None | 0 0
  1. #!/bin/bash
  2. #-----------------------------------------------------------------------------
  3. # Use:
  4. # $ ./storeqr.sh "Filename" "YoUR EncRYPtion KeY"
  5. # If you get an error message about parallel not liking -N
  6. # you probably have moreutils installed instead of parallel
  7. # sudo apt-get install parallel
  8. #-----------------------------------------------------------------------------
  9.  
  10. COUNTER=0
  11. IFS=$'\n'
  12.  
  13. #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N71 echo) #Low/Default error correction
  14. for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N10 echo) #Low/Default error correction
  15. #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N56 echo) #Medium error correction
  16. #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N40 echo) #Q error correction
  17. #for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N30 echo) #High error correction
  18. do
  19.     let COUNTER+=1
  20.     echo "Working on QRcode $COUNTER"
  21.     PADCOUNT=$(printf "%08d" $COUNTER)
  22.     qrencode -m 8 -o $PADCOUNT.png "$ldata"       #Normal/Low error correction
  23.     #qrencode -l M -o $PADCOUNT.png "$ldata" #Medium error correction
  24.     #qrencode -l Q -o $PADCOUNT.png "$ldata" #Q error correction
  25.     #qrencode -l H -o $PADCOUNT.png "$ldata" #high error correction
  26.     convert $PADCOUNT.png -gravity South -pointsize 15 -annotate +0+0 "$PADCOUNT" $PADCOUNT.png
  27. done
  28.  
  29. #convert *.png "$(basename $1).pdf"
  30. montage -page A4 -compress JPEG *.png -tile 3x4 -geometry 300 "$(basename $1).pdf"
  31. rm *.png
  32.  
  33. #-----------------------------------------------------------------------------
  34. # To restore file from qrcodes:
  35. # scan all the qrcodes and save as sequential images, then run
  36. # $ zbarimg -q --raw *.png | sed 's/[0-9]*//g' |codegroup -d |ccrypt -d -K "YoUR EncRYPtion KeY" |gzip -d > out.file
  37. #
  38. # Or scan each QRcode with your phone and save the codegroup text as one block of text then
  39. # $ cat thesavedcodegroup.txt | codegroup -d |ccrypt -d -K "YoUR EncRYPtion KeY" |gzip -d > out.file
  40. #-----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement