Skip to content

Commit b982b31

Browse files
committed
add ASN fallbacks for Korean providers, fix Microsoft IP ranges URL
1 parent 22400ae commit b982b31

9 files changed

Lines changed: 19 additions & 6 deletions

File tree

cloudcheck/providers/gabia.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Gabia(BaseProvider):
77
short_description: str = "Gabia (가비아)"
88
long_description: str = "A Korean cloud hosting and infrastructure provider."
99
# {"org_id": "@aut-17589-APNIC", "org_name": null, "country": null, "asns": [17589]}
10+
asns: List[int] = [17589]
1011
org_ids: List[str] = [
1112
"@aut-17589-APNIC",
1213
]

cloudcheck/providers/hostway.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Hostway(BaseProvider):
88
long_description: str = "A Korean cloud hosting and infrastructure provider."
99
# {"org_id": "@aut-9952-APNIC", "org_name": null, "country": null, "asns": [9952]}
1010
# {"asn":9952,"asn_name":"HOSTWAY-AS-KR","org_id":"@aut-9952-APNIC"}
11+
asns: List[int] = [9952]
1112
org_ids: List[str] = [
1213
"@aut-9952-APNIC",
1314
]

cloudcheck/providers/kinx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Kinx(BaseProvider):
99
"A Korean content delivery network and cloud infrastructure provider."
1010
)
1111
# {"org_id": "@aut-9286-APNIC", "org_name": null, "country": null, "asns": [9286,9957,17604]}
12+
asns: List[int] = [9286, 9957, 17604]
1213
org_ids: List[str] = [
1314
"@aut-9286-APNIC",
1415
]

cloudcheck/providers/ktcloud.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Ktcloud(BaseProvider):
99
"A Korean cloud computing service provided by KT Corporation."
1010
)
1111
# {"asn":9947,"asn_name":"KTC-AS-KR","country":null,"org":null,"org_id":"@aut-152232-APNIC","rir":null,"subnets":["61.100.71.0/24","61.100.72.0/24"]}
12+
asns: List[int] = [9947]
1213
org_ids: List[str] = [
1314
"@aut-152232-APNIC",
1415
]

cloudcheck/providers/lgtelecom.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Lgtelecom(BaseProvider):
88
long_description: str = "A Korean telecommunications company offering CDN services."
99
# {"org_id": "@aut-17853-APNIC", "org_name": null, "country": null, "asns": [17853]}
1010
# {"asn":17853,"asn_name":"LGTELECOM-AS-KR","org_id":"@aut-17853-APNIC"}
11+
asns: List[int] = [17853]
1112
org_ids: List[str] = [
1213
"@aut-17853-APNIC",
1314
]

cloudcheck/providers/microsoft.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
from cloudcheck.providers.base import BaseProvider
24
from typing import List, Dict
35

@@ -27,13 +29,16 @@ class Microsoft(BaseProvider):
2729
],
2830
}
2931

30-
_ips_url = "https://download.microsoft.com/download/0/1/8/018E208D-54F8-44CD-AA26-CD7BC9524A8C/PublicIPs_20200824.xml"
32+
_ips_confirmation_url = "https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519"
3133

3234
def fetch_cidrs(self):
33-
response = self.request(self._ips_url)
35+
confirmation = self.request(self._ips_confirmation_url, browser_headers=True)
36+
match = re.search(r'https://download\.microsoft\.com/download/[^"]+\.json', confirmation.text)
37+
if not match:
38+
raise ValueError("Could not find Azure IP ranges download URL")
39+
response = self.request(match.group(0))
3440
ranges = set()
35-
for line in response.text.splitlines():
36-
if "IpRange Subnet" in line:
37-
ip_range = line.split('"')[1]
38-
ranges.add(ip_range)
41+
for entry in response.json().get("values", []):
42+
for prefix in entry.get("properties", {}).get("addressPrefixes", []):
43+
ranges.add(prefix)
3944
return list(ranges)

cloudcheck/providers/navercloud.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Navercloud(BaseProvider):
1010
)
1111
# "org_id": "@aut-23576-APNIC", "org_name": null, "country": null, "asns": [23576,23982]}
1212
# {"asn":23576,"asn_name":"nhn-AS-KR","org_id":"@aut-23576-APNIC"}
13+
asns: List[int] = [23576, 23982]
1314
org_ids: List[str] = [
1415
"@aut-23576-APNIC",
1516
]

cloudcheck/providers/nhncloud.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Nhncloud(BaseProvider):
1010
)
1111
# {"org_id": "@aut-10038-APNIC", "org_name": null, "country": null, "asns": [10038,45974,152291]}
1212
# {"asn":45974,"asn_name":"NHN-AS-KR","org_id":"@aut-10038-APNIC"}
13+
asns: List[int] = [10038, 45974, 152291]
1314
org_ids: List[str] = [
1415
"@aut-10038-APNIC",
1516
]

cloudcheck/providers/skbroadband.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Skbroadband(BaseProvider):
88
long_description: str = "A Korean telecommunications company offering CDN services."
99
# {"org_id": "@aut-10049-APNIC", "org_name": null, "country": null, "asns": [9705,10049]}
1010
# {"asn":10049,"asn_name":"SKNET-AS","country":null,"org":null,"org_id":"@aut-10049-APNIC"}
11+
asns: List[int] = [9705, 10049]
1112
org_ids: List[str] = [
1213
"@aut-10049-APNIC",
1314
]

0 commit comments

Comments
 (0)