aboutsummaryrefslogtreecommitdiff
path: root/utils/azure_ip_addresses_download.sh
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2022-01-23 18:55:36 +0100
committerLuca Deri <deri@ntop.org>2022-01-23 18:56:51 +0100
commita8fe74e502461cf6d6d1dee3567a3c39445d301e (patch)
tree332295bfa26ac6c8dbe6a058e3aa06e51b3e7366 /utils/azure_ip_addresses_download.sh
parent20b9f01f127a9fe803492440ade44b32981959b7 (diff)
Tool for generating automatically the Azure IP list
Diffstat (limited to 'utils/azure_ip_addresses_download.sh')
-rwxr-xr-xutils/azure_ip_addresses_download.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/azure_ip_addresses_download.sh b/utils/azure_ip_addresses_download.sh
new file mode 100755
index 000000000..a1e2930f9
--- /dev/null
+++ b/utils/azure_ip_addresses_download.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+OUT=../src/lib/ndpi_azure_match.c.inc
+TMP=/tmp/azure.json
+
+echo "(1) Downloading file..."
+# https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519
+curl -s https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_20211213.json -o $TMP
+
+echo "(2) Processing IP addresses..."
+# Note: the last "grep -v :" is used to skip IPv6 addresses
+tr -d '\r' < $TMP | grep / | tr -d '"' | tr -d " " | tr -d "," | grep -v : > $OUT
+./ipaddr2list.py $OUT NDPI_PROTOCOL_MICROSOFT_AZURE > $TMP
+/bin/mv $TMP $OUT
+
+echo "(3) Microsoft Azure IPs are available in $OUT"
+
+
+