diff options
Diffstat (limited to 'utils/cloudflare_ip_addresses_download.sh')
-rwxr-xr-x | utils/cloudflare_ip_addresses_download.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/cloudflare_ip_addresses_download.sh b/utils/cloudflare_ip_addresses_download.sh new file mode 100755 index 000000000..8dd1d3176 --- /dev/null +++ b/utils/cloudflare_ip_addresses_download.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +cd "$(dirname "${0}")" + +DEST=../src/lib/ndpi_cloudflare_match.c.inc +LIST=/tmp/cloudflare.list +# TODO: ipv6 list from https://www.cloudflare.com/ips-v6 +ORIGIN="https://www.cloudflare.com/ips-v4" + + +echo "(1) Downloading file..." +http_response=$(curl -s -o $LIST -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..." +./ipaddr2list.py $LIST NDPI_PROTOCOL_CLOUDFLARE > $DEST +rm -f $LIST + +echo "(3) Cloudflare IPs are available in $DEST" + + + |