-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMake.sh
77 lines (77 loc) · 1.9 KB
/
Make.sh
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
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2021-2024 MDP43140
# SPDX-License-Identifier: GPL-3.0-or-later
#
clear
[ "$1" ] || (echo -e "Arguments required. no argument was given.\ntry -h to show help page.";exit 1);
VERSION=$(date +%d.%m.%Y)
UPDATE_FREQ="7 days" # unused
HOSTSFILE_TYPES=(
"BaDomain"
"misc/NoApple"
"misc/NoChinaOverseaSpy"
"misc/NoFB"
"misc/NoGambling"
"misc/NoFreeFire"
"misc/NoMalware"
"misc/NoMLBB"
"misc/NoNSFW"
"misc/NoOppoHT"
"misc/NoRoblox"
"misc/NoSamsung"
"misc/NoScam"
"misc/NoTikTok"
"misc/NoVivo"
"misc/NoXiaomi"
)
HOSTSFILE_TYPES="${HOSTSFILE_TYPES[@]}"
for i in "$@";do
case "${i,,}" in
-h|--help|h)
echo
echo " HostsBuilder (Usage: $0 [action])"
echo "-------------------------"
echo " h | Display this help page"
echo " b | Cleans old files and dupes, Create all hosts files, and clean again"
echo " c | Clean .old files"
echo " ca | Clean .old files and hosts file"
echo
exit 0
;;
b)
echo "[!] This will delete/override .old backups! Renaming old hosts..."
for i in $HOSTSFILE_TYPES;do
rm -f $i{,_hosts}.txt.old
[ -f "${i}_hosts.txt" ] && mv "${i}_hosts.txt"{,.old}
done
echo "[i] Removing dupes..."
for i in $HOSTSFILE_TYPES;do
$SHELL scripts/sortAndRemoveDupe.sh $i
done
$SHELL scripts/sortAndRemoveDupe.sh BaDomain_notExists
echo "[i] Creating hosts..."
for i in $HOSTSFILE_TYPES;do
$SHELL scripts/domain2hosts.sh $i
done
echo "[i] Updating 'BaDomain_Uncensor' date..."
sed -ri 's/Version: [0-9]{2}\.[0-9]{2}\.[0-9]{2,4}/Version: '$VERSION'/i' BaDomain_Uncensor.txt
echo -n "[i] Cleaning..."
rm $(ls *.old misc/*.old)
echo -e "\r[+] Done!\e[0K"
;;
c)
echo "Cleaning..."
rm $(ls *.old misc/*.old)
;;
ca)
echo "Cleaning..."
rm $(ls *.old misc/*.old *hosts.txt misc/*hosts.txt)
;;
*)
echo "Invalid argument. try -h to show help page."
exit 1
;;
esac
done
exit 0