forked from willwhite/freemail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·68 lines (58 loc) · 1.58 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
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
set -e
tmp=$(mktemp -t freemailXXX)
cat ./data/blacklist.txt \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq > $tmp
mv $tmp ./data/blacklist.txt
tmp=$(mktemp -t freemailXXX)
cat ./data/free.txt \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/blacklist.txt > $tmp
mv $tmp ./data/free.txt
tmp=$(mktemp -t freemailXXX)
cat ./data/disposable.txt \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/blacklist.txt \
| comm -23 - ./data/free.txt > $tmp
mv $tmp ./data/disposable.txt
sources=$(cat ./data/sources.txt)
new=$(mktemp -t freemailXXX)
for source in $sources; do
echo "$(curl --silent $source)" >> $new
done;
curl --silent https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json | jq -r .[] >> $new
tmp=$(mktemp -t freemailXXX)
cat $new \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/blacklist.txt \
| comm -23 - ./data/free.txt \
| comm -23 - ./data/disposable.txt > $tmp
confirmed=$(mktemp -t freemailXXX)
for domain in $(cat $tmp); do
result=`dig +short mx $domain`
if [ -n "$result" ]; then
echo $domain >> $confirmed
fi
done
tmp=$(mktemp -t freemailXXX)
cat $confirmed ./data/free.txt \
| sort \
| uniq > $tmp
mv $tmp ./data/free.txt
echo 'Complete!'