-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsave
executable file
·69 lines (66 loc) · 2.29 KB
/
save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
DOMAIN="$1"
if [[ "$2" == "" ]]
then
START_URL="http://$DOMAIN"
else
START_URL="$2"
fi
PARAMS="--domains=$DOMAIN,www.$DOMAIN,$SAVESITES_DOMAINS $3 $4 $5 $6 $7 $8 $9 $START_URL"
SUBDIR="backup_$DOMAIN"
if [ -e "$SUBDIR" ]; then
echo "$SUBDIR already exists (completely downloaded, but when?)"
elif [ -e "$SUBDIR.zip" ]; then
echo "$SUBDIR already exists (completely downloaded and zipped)"
exit
elif [ -e "~$SUBDIR" ]; then
echo "~$SUBDIR already exists (incompletely downloaded), you should remove it"
exit 1
else
mkdir "~$SUBDIR"
cd "~$SUBDIR"
dig +trace $DOMAIN | tee -a dig.log
dig +trace $DOMAIN ANY | tee -a dig.log
dig +trace $DOMAIN TXT | tee -a dig.log
whois $DOMAIN | tee -a whois.log
echo "wget ... $PARAMS" | tee -a wget.log
wget --continue --recursive --follow-ftp --retr-symlinks --restrict-file-names=windows --convert-links -e robots=off -E --tries=5 --mirror -K -p --no-check-certificate --user-agent="Mozilla/5.0 (Windows NT 10.0; rv:92.0) Gecko/20100101 Firefox/92.0" --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" --timestamping -H $PARAMS 2>&1 | tee -a wget.log
if [ $? -eq 0 ]
then
#du -h $DOMAIN 2>&1 | tee -a wget.log
#du -h www.$DOMAIN 2>&1 | tee -a wget.log
wget --timeout=10 --output-document=informer.html https://website.informer.com/$DOMAIN 2>&1 | tee -a wget.log
wget --timeout=10 --output-document=emails.html https://website.informer.com/$DOMAIN/emails 2>&1 | tee -a wget.log
wget --timeout=10 --output-document=scorecard.html https://www.mywot.com/en/scorecard/$DOMAIN 2>&1 | tee -a wget.log
du -h . 2>&1 | tee -a wget.log
echo -n "Counting... "
FILESCOUNT=$(find . | wc -l)
echo "$FILESCOUNT files" | tee -a wget.log
cd ..
mv "~$SUBDIR" "$SUBDIR"
echo "$SUBDIR downloaded successfully (perhaps)"
else
cd ..
echo "~$SUBDIR downloaded partially (check if sufficient disk space)"
exit 1
fi
fi
ZIPFILE="$SUBDIR.zip"
if [ -d "$SUBDIR" ]; then
if [ ! -e "$ZIPFILE" ]; then
zip -9 -T -r $ZIPFILE $SUBDIR
if [ $? -eq 0 ]; then
if [ ! -e "~$SUBDIR" ]; then
echo -n "Deleting ~$SUBDIR..."
mv "$SUBDIR" "~$SUBDIR"
rm -r "~$SUBDIR"
if [ $? -eq 0 ]; then
echo " Done"
else
echo ""
exit 1
fi
fi
fi
fi
fi