mirror of
https://github.com/dirtbags/moth.git
synced 2025-01-05 11:30:41 -07:00
25 lines
528 B
Bash
Executable file
25 lines
528 B
Bash
Executable file
#! /bin/sh -e
|
|
|
|
base=${CTF_BASE:-/var/lib/ctf}
|
|
www=${CTF_BASE:-/var/www}
|
|
pass=$base/pass
|
|
img=$www/bkup.png
|
|
time=$(date +%s)
|
|
output=bkup-${time}.png
|
|
|
|
if [ ! -e $img -o ! -e $pass ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# clean up all other backup images
|
|
if ls $www/bkup-*.png >/dev/null 2>&1 ; then
|
|
rm $www/bkup-*.png
|
|
fi
|
|
|
|
# This is a tested method.
|
|
#(cat $img; tar -cf - $base 2>/dev/null | gzip -c ) > $www/$output
|
|
|
|
# This is not a tested method.
|
|
(cat $img; tar -cvf - $base 2>/dev/null | gzip -c | rc4 3< $pass) > $www/$output
|
|
|
|
echo $output
|