diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/icloud_private_relay_ip_addresses_download.sh | 30 | ||||
-rwxr-xr-x | utils/ipaddr2list.py | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/utils/icloud_private_relay_ip_addresses_download.sh b/utils/icloud_private_relay_ip_addresses_download.sh new file mode 100755 index 000000000..149185d83 --- /dev/null +++ b/utils/icloud_private_relay_ip_addresses_download.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +cd "$(dirname "${0}")" || return + +DEST=../src/lib/ndpi_icloud_private_relay_match.c.inc +TMP=/tmp/icloud.csv +LIST=/tmp/icloud.list +LIST_MERGED=/tmp/icloud.list_m +ORIGIN="https://mask-api.icloud.com/egress-ip-ranges.csv" + + +echo "(1) Downloading file..." +http_response=$(curl -s -o "$TMP" -w "%{http_code}" ${ORIGIN}) +if [ "$http_response" != "200" ]; then + echo "Error $http_response: you probably need to update the list url!" + return +fi + +echo "(2) Processing IP addresses..." + +# Note: the "grep -v :" is used to skip IPv6 addresses +cut -d ',' -f 1 $TMP | grep -v ':' > $LIST +./mergeipaddrlist.py $LIST > $LIST_MERGED +./ipaddr2list.py $LIST_MERGED NDPI_ANONYMOUS_SUBSCRIBER > $DEST +rm -f $TMP $LIST $LIST_MERGED + +echo "(3) iCloud Private Relay IPs are available in $DEST" + + + diff --git a/utils/ipaddr2list.py b/utils/ipaddr2list.py index f43ec3ca1..5b2b10bf3 100755 --- a/utils/ipaddr2list.py +++ b/utils/ipaddr2list.py @@ -3,6 +3,8 @@ import sys import socket, struct +# This scripts is mainly used to create "ip -> protocols" lists. +# However it is also used to create "ip -> risk" lists proto = "NDPI_PROTOCOL_XYX" if len (sys.argv) < 2 : print("Usage: ipaddr2list.py <file> <protocol>") |