Skip to content

Commit

Permalink
Fix download microsoft ipranges
Browse files Browse the repository at this point in the history
  • Loading branch information
lord-alfred authored Dec 7, 2024
1 parent 88ae073 commit 0caf36d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions microsoft/downloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -x

# get from public ranges
download_and_parse_json() {
URL="$(curl -s https://www.microsoft.com/en-us/download/confirmation.aspx?id=${1} | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | grep ServiceTags_ | head -1 | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//')"
URL="$(curl -s https://www.microsoft.com/en-us/download/details.aspx?id=${1} | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | grep ServiceTags_ | head -1 | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//')"
curl --connect-timeout 60 --retry 3 --retry-delay 15 -s "${URL}" > /tmp/microsoft.json
jq '.values[] | [.properties] | .[].addressPrefixes[] | select(. != null)' -r /tmp/microsoft.json > /tmp/microsoft-all.txt

Expand All @@ -22,7 +22,7 @@ download_and_parse_json() {
}

download_and_parse_csv() {
URL="$(curl -s https://www.microsoft.com/en-us/download/confirmation.aspx?id=${1} | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | grep msft-public-ips | head -1 | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//')"
URL="$(curl -s https://www.microsoft.com/en-us/download/details.aspx?id=${1} | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | grep msft-public-ips | head -1 | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//')"
curl --connect-timeout 60 --retry 3 --retry-delay 15 -s "${URL}" > /tmp/microsoft.csv
awk -F ',' '{print $1}' /tmp/microsoft.csv | grep -E '[:.]+' > /tmp/microsoft-all.txt

Expand Down

0 comments on commit 0caf36d

Please sign in to comment.