FakeKitten, or how to trick Amazon Prime Photos to store anything
Scope: #
Some have an Amazon Prime with Unlimited Photo Storage,
it would be a pity to use it just for photos.
How: #
The script creates a new file and adds the photo of a very cute kitten at the end of it.
In this way the file gets recognized as a photo and won't count against your usable space (this is after uploading 3.3GB of "fakekitten-ed" ubuntu iso):
In the encoding phase useful data gets stored in the destination filename,
this data will be used for decoding and checking that the image is consistent and not corrupted.
Unfortunately the upload will be done manually since the APIs for Amazon Drive are not available anymore [0] and we won't be able to use automated tools.
More info on the incident that allegedly kicked off the API removal [1]
Encoding: #
- stores imagesize of the kitten image
- creates sha1 checksum of the original file
- creates filename with useful data: "FakeKitten_JpgImgSize_OrigFileName_OrigFileSha_ImageFilename"
- FakeKitten: fixed text
- JpgImgSize: the filesize of the kitten.jpg image
- OrigFileName: filename of the original file
- OrigFileSha: sha1sum of the original file
- ImageFilename: image filename (kitten.jpg)
- appends the image at the end of the file
Decoding: #
- retrieves the variables from the filename
- creates new file skipping the appended image at the end of the file
- creates sha1 checksum of the downloaded file and checks it against the filename
Prerequisites: #
You will need:
- something that runs bash
- kitten image
- the files you want to upload
- obv. an Amazon Prime account to upload the "photos"
Instructions: #
just run the script with the options:
Encode: ./AmazonPrimeWhatever.sh fileName encode
Decode: ./AmazonPrimeWhatever.sh fileName decode
The script: #
#!/usr/bin/env bash
if [ -z "$1" ] || [ -z "$2" ] || [[ $2 != "encode" && $2 != "decode" ]]
then echo "launch the script with the desired filename and operation"
echo "./AmazonPrimeWhatever.sh FILENAME OPERATION(encode or decode)"
exit
fi
image="kitten.jpg"
imagesize=$(du -b $image | cut -f1)
origsha=$(sha1sum $1 | cut -d " " -f1)
destimage="FakeKitten_"$imagesize"_"$1"_"$origsha"_"$image
if [ $2 = "encode" ]
then cp $image $destimage
dd if=$1 bs=1M >> "$destimage"
echo "encode completed in $destimage"
fi
if [ $2 = "decode" ]; then
imagebs=$(echo $1 | cut -d "_" -f2)
origname=$(echo $1 | cut -d "_" -f3)
origsha=$(echo $1 | cut -d "_" -f4)
origimage=$(echo $1 | cut -d "_" -f5)
dd if=$1 bs=1M skip=$imagebs iflag=skip_bytes > "$origname"
echo "decode completed in $origimage, checking file integrity"
echo $origsha" "$origname > $origname".sha1"
shaoutput=$(sha1sum -c $origname".sha1")
echo $shaoutput
if [[ $shaoutput != *"OK"* ]]; then
echo ""
echo "!!! FAILED SHA VERIFICATION!!! EXITING"
echo "!!! DELETING ALL CREATED FILES !!!"
rm $origname
rm $origname".sha1"
exit
fi
rm $origname".sha1"
fi
echo ""
echo "end of my job"