forked from dpup/freemail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·59 lines (48 loc) · 1.57 KB
/
update
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
#!/usr/bin/env bash
set -e
curl --silent https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json | jq -r .[] > ./data/disposable.txt
curl --silent https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/wildcard.json | jq -r .[] >> ./data/disposable.txt
tmp=$(mktemp -t freemailXXX)
cat ./data/disposable.txt \
| sort \
| uniq > $tmp
mv $tmp ./data/disposable.txt
curl --silent https://www.stopforumspam.com/downloads/toxic_domains_whole.txt > ./data/spammy.txt
tmp=$(mktemp -t freemailXXX)
cat ./data/spammy.txt \
| sed "s/^[^[:alnum:]]//g" \
| sort \
| uniq > $tmp
mv $tmp ./data/spammy.txt
sources=$(cat ./data/sources.txt)
new_free=$(mktemp -t freemailXXX)
for source in $sources; do
echo "$(curl --silent $source)" >> $new_free
done;
deduped=$(mktemp -t freemailXXX)
cat $new_free \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| sed "s/^[^[:alnum:]]//g" \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/free.txt \
| comm -23 - ./data/disposable.txt \
| comm -23 - ./data/spammy.txt > $deduped
# NOTE: Checking DNS records is pretty slow. Having dead domains doesn't seem
# like that bad of an issue.
# confirmed=$(mktemp -t freemailXXX)
# for domain in $(cat $deduped); do
# echo "Checking $domain"
# result=`dig +short mx $domain`
# if [ -n "$result" ]; then
# echo $domain >> $confirmed
# fi
# done
tmp=$(mktemp -t freemailXXX)
cat $deduped ./data/free.txt \
| sort \
| uniq > $tmp
mv $tmp ./data/free.txt
echo 'Complete!'