diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-02-09 11:45:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-09 11:45:48 +0100 |
commit | a6ff0dd0e3b14e3f7e396a1d5ea125cc2ae9b82f (patch) | |
tree | 7e1f930b8059467ac53cba9b1b29d65bdb1bbe80 /utils/azure_ip_addresses_download.sh | |
parent | 8cc5cb9f767119f7219c918843893bdeaa98d909 (diff) |
Add few scripts to easily update some IPs lists (#1436)
* Add few scripts to easily update some IPs lists
Some IPs lists should be updated frequently: try to easy the process.
The basic idea is taken from d59fefd0 and a8fe74e5 (for Azure
addresses): one specific .c.inc file and one script for each protocol.
Add the possibility to don't load a specific list.
Rename the old NDPI_PROTOCOL_HOTMAIL id to NDPI_PROTOCOL_MS_OUTLOOK,
to identify Hotmail/Outlook/Exchange flows.
TODO: ipv6
Remove the 9 addresses associated to BitTorrent: they have been added in
e2f21116 but it is not clear why all the traffic to/from these ips
should be classified as BitTorrent.
* Added quotes
* Added quotes
Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
Diffstat (limited to 'utils/azure_ip_addresses_download.sh')
-rwxr-xr-x | utils/azure_ip_addresses_download.sh | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/utils/azure_ip_addresses_download.sh b/utils/azure_ip_addresses_download.sh index a1e2930f9..7f0bd81dd 100755 --- a/utils/azure_ip_addresses_download.sh +++ b/utils/azure_ip_addresses_download.sh @@ -1,19 +1,28 @@ #!/bin/sh -OUT=../src/lib/ndpi_azure_match.c.inc +cd "$(dirname "${0}")" + +DEST=../src/lib/ndpi_azure_match.c.inc TMP=/tmp/azure.json +LIST=/tmp/azure.list +# https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519 +ORIGIN="https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_20220124.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 +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 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 +tr -d '\r' < $TMP | grep / | tr -d '"' | tr -d " " | tr -d "," | grep -v : > $LIST +./ipaddr2list.py $LIST NDPI_PROTOCOL_MICROSOFT_AZURE > $DEST +rm -f $TMP $LIST -echo "(3) Microsoft Azure IPs are available in $OUT" +echo "(3) Microsoft Azure IPs are available in $DEST" |