forked from borestad/blocklist-abuseipdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron
executable file
·50 lines (41 loc) · 904 Bytes
/
cron
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
#!/usr/bin/env bash
. .github/scripts/helpers
mkt () {
cd $(mktemp -d)
pwd
}
TEMPDIR=$(mkt)
TEMPFILE=$(mktemp)
FILE="abuseipdb-s100.ipv4"
# 1.1 Download from AbuseIPDB
curl -G https://api.abuseipdb.com/api/v2/blacklist \
-L \
--fail \
--no-progress-meter \
-d confidenceMinimum=100 \
-d limit=9999999 \
-H "Key: $ABUSEIPDB_TOKEN" \
-H "Accept: text/plain" \
-o $TEMPDIR/1.ip
# 1.2 Download from other sources
curl -G bit.ly/3ANJ6wE \
-L \
--fail \
--no-progress-meter \
-H "Accept: text/plain" \
-o $TEMPDIR/2.ip
curl -G https://abuseipdb.tmiland.com/abuseipdb.txt \
-L \
--fail \
--no-progress-meter \
-H "Accept: text/plain" \
-o $TEMPDIR/3.ip
# 2. Extract data
cat $TEMPDIR/*.ip | \
grep -v ":" | \
iprange --print-single-ips | \
sponge $TEMPFILE
# 3. Validate data
if [[ "`wc -l < $TEMPFILE`" -gt "1000" ]]; then
mv $TEMPFILE $GIT_ROOT/$FILE
fi