-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadcrack.sh
executable file
·42 lines (38 loc) · 1.05 KB
/
adcrack.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
#!/bin/zsh
function rmtemp {
rm -rf -- $Temp
exit 130
#Exits with the return code of a control c
}
export Temp=`mktemp -d`
export UserStoredLoc="$HOME/.adcrack/"
export RootStoredLoc="/etc/adcrack/"
export TempMerged="$Temp/Merged
#Creates a default file if not exist
#{
export Defaults="https://easylist-downloads.adblockplus.org/easylist.txt
https://spam404bl.com/spam404scamlist.txt
https://easylist-downloads.adblockplus.org/malwaredomains_full.txt
http://easylist-downloads.adblockplus.org/easyprivacy.txt"
#}
#Create does the actual file
#{
if [ -e ! "$RootStoredLoc" ] && [ ! -s "$RootStoredLoc" ]; then
if [ -w "$RootStoredLoc" ]; then
mkdir -P -- $RootStoredLoc
echo $Defaults > $RootStoredLoc
fi
fi
#}
echo $Defaults > $UserStoredLoc
cat -- $UserStoredLoc $RootStoredLoc > $TempMerged
wget -P $Temp -i $TempMerged --
cat "$Temp/*" | uniq > "$Temp/adblock.txt"
#In the event of an unexpected exit, this script removes the temp dir
#{
trap -- 'rmtemp' EXIT
trap -- 'rmtemp' SIGHUP
trap -- 'rmtemp' SIGINT
trap -- 'rmtemp' SIGQUIT
trap -- 'rmtemp' SIGTERM
#}