q
added all the files
This commit is contained in:
parent
969eaf729c
commit
eeb6520fec
4 changed files with 111 additions and 0 deletions
43
AmazonPrimeWhatever.sh
Executable file
43
AmazonPrimeWhatever.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/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"
|
34
_backup/AmazonPrimeWhatever.sh
Executable file
34
_backup/AmazonPrimeWhatever.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/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"
|
||||
sha1sum -c $origname".sha1"
|
||||
rm $origname".sha1"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "end of my job"
|
34
_backup/AmazonPrimeWhatever.sh_BCK201710101045
Executable file
34
_backup/AmazonPrimeWhatever.sh_BCK201710101045
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/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"
|
||||
sha1sum -c $origname".sha1"
|
||||
rm $origname".sha1"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "end of my job"
|
BIN
kitten.jpg
Normal file
BIN
kitten.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
Loading…
Reference in a new issue