forked from willwhite/freemail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·48 lines (40 loc) · 1.12 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
#!/usr/bin/env bash
set -e
export LC_CTYPE=C
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
new=$(mktemp -t freemailXXX)
curl --silent https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json | jq -r .[] > $new
tmp=$(mktemp -t freemailXXX)
cat $new ./data/disposable.txt \
| sed '/^$/d' \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/blacklist.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;
tmp=$(mktemp -t freemailXXX)
cat $new ./data/free.txt \
| sed '/^$/d' \
| sed '/./,$!d' \
| sed -e 's/^ *//' -e 's/ *$//' \
| awk '{print tolower($0)}' \
| sort \
| uniq \
| comm -23 - ./data/blacklist.txt \
| comm -23 - ./data/disposable.txt > $tmp
mv $tmp ./data/free.txt
echo 'Complete!'