cloudcheck 6.0.0.686__tar.gz → 7.0.694__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cloudcheck might be problematic. Click here for more details.

Files changed (25) hide show
  1. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/PKG-INFO +2 -2
  2. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloud_providers.json +21 -16
  3. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/cloudcheck.py +1 -3
  4. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/helpers.py +1 -1
  5. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/__init__.py +6 -14
  6. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/amazon.py +1 -5
  7. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/azure.py +4 -4
  8. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/base.py +2 -6
  9. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/digitalocean.py +1 -5
  10. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/test/test_cloudcheck.py +1 -2
  11. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/pyproject.toml +14 -6
  12. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/README.md +0 -0
  13. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/__init__.py +0 -0
  14. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/akamai.py +0 -0
  15. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/arvancloud.py +0 -0
  16. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/cloudflare.py +0 -0
  17. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/cloudfront.py +0 -0
  18. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/fastly.py +0 -0
  19. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/github.py +0 -0
  20. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/google.py +0 -0
  21. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/hetzner.py +0 -0
  22. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/imperva.py +0 -0
  23. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/oracle.py +0 -0
  24. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/providers/zoho.py +0 -0
  25. {cloudcheck-6.0.0.686 → cloudcheck-7.0.694}/cloudcheck/test/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudcheck
3
- Version: 6.0.0.686
3
+ Version: 7.0.694
4
4
  Summary: Check whether an IP address belongs to a cloud provider
5
5
  Home-page: https://github.com/blacklanternsecurity/cloudcheck
6
6
  License: GPL-3.0
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Requires-Dist: httpx (>=0.26,<0.29)
17
17
  Requires-Dist: pydantic (>=2.4.2,<3.0.0)
18
- Requires-Dist: radixtarget (>=2.0.0.32,<3.0.0.0)
18
+ Requires-Dist: radixtarget (>=3.0.13,<4.0.0)
19
19
  Requires-Dist: regex (>=2024.4.16,<2025.0.0)
20
20
  Project-URL: Discord, https://discord.com/invite/PZqkgxu5SA
21
21
  Project-URL: PyPi, https://pypi.org/project/cloudcheck/
@@ -860,6 +860,7 @@
860
860
  "122.252.32.0/19",
861
861
  "122.252.40.0/21",
862
862
  "124.106.175.0/24",
863
+ "124.40.52.208/28",
863
864
  "125.252.192.0/18",
864
865
  "125.252.212.0/22",
865
866
  "125.252.216.0/22",
@@ -3064,6 +3065,7 @@
3064
3065
  "2.22.232.0/24",
3065
3066
  "2.22.235.0/24",
3066
3067
  "2.22.236.0/24",
3068
+ "2.22.237.0/24",
3067
3069
  "2.22.238.0/24",
3068
3070
  "2.22.239.0/24",
3069
3071
  "2.22.24.0/22",
@@ -9316,6 +9318,7 @@
9316
9318
  "2a02:26f0:c6::/48",
9317
9319
  "2a02:26f0:c80::/48",
9318
9320
  "2a02:26f0:c900::/48",
9321
+ "2a02:26f0:c9::/48",
9319
9322
  "2a02:26f0:cc00::/48",
9320
9323
  "2a02:26f0:cd00::/48",
9321
9324
  "2a02:26f0:ce00::/48",
@@ -11841,7 +11844,7 @@
11841
11844
  "srtcdn.net"
11842
11845
  ],
11843
11846
  "ips_url": "https://techdocs.akamai.com/property-manager/pdfs/akamai_ipv4_ipv6_CIDRs-txt.zip",
11844
- "last_updated": "2024-12-02T22:09:08.890593",
11847
+ "last_updated": "2024-12-03T00:40:32.586686",
11845
11848
  "name": "Akamai",
11846
11849
  "provider_type": "cdn",
11847
11850
  "regexes": {}
@@ -12090,7 +12093,10 @@
12090
12093
  "13.127.70.160/29",
12091
12094
  "13.134.0.0/15",
12092
12095
  "13.184.0.0/13",
12093
- "13.192.0.0/13",
12096
+ "13.192.0.0/16",
12097
+ "13.193.0.0/16",
12098
+ "13.194.0.0/15",
12099
+ "13.196.0.0/14",
12094
12100
  "13.200.0.0/15",
12095
12101
  "13.200.140.0/23",
12096
12102
  "13.200.142.112/30",
@@ -15614,7 +15620,6 @@
15614
15620
  "35.96.4.0/24",
15615
15621
  "35.96.48.0/20",
15616
15622
  "35.96.5.0/24",
15617
- "35.96.6.0/24",
15618
15623
  "35.96.64.0/20",
15619
15624
  "35.96.8.0/24",
15620
15625
  "35.96.80.0/20",
@@ -18069,7 +18074,7 @@
18069
18074
  "thinkboxsoftware.com"
18070
18075
  ],
18071
18076
  "ips_url": "https://ip-ranges.amazonaws.com/ip-ranges.json",
18072
- "last_updated": "2024-12-02T22:09:08.881831",
18077
+ "last_updated": "2024-12-03T00:40:32.584496",
18073
18078
  "name": "Amazon",
18074
18079
  "provider_type": "cloud",
18075
18080
  "regexes": {
@@ -18124,7 +18129,7 @@
18124
18129
  "arvancloud.ir"
18125
18130
  ],
18126
18131
  "ips_url": "https://www.arvancloud.ir/en/ips.txt",
18127
- "last_updated": "2024-12-02T22:09:09.472112",
18132
+ "last_updated": "2024-12-03T00:40:32.866811",
18128
18133
  "name": "Arvancloud",
18129
18134
  "provider_type": "cdn",
18130
18135
  "regexes": {}
@@ -21817,7 +21822,7 @@
21817
21822
  "windowsazurestatus.cn"
21818
21823
  ],
21819
21824
  "ips_url": "https://download.microsoft.com/download/0/1/8/018E208D-54F8-44CD-AA26-CD7BC9524A8C/PublicIPs_20200824.xml",
21820
- "last_updated": "2024-12-02T22:09:08.415315",
21825
+ "last_updated": "2024-12-03T00:40:31.331342",
21821
21826
  "name": "Azure",
21822
21827
  "provider_type": "cloud",
21823
21828
  "regexes": {
@@ -21888,7 +21893,7 @@
21888
21893
  "workers.dev"
21889
21894
  ],
21890
21895
  "ips_url": "https://api.cloudflare.com/client/v4/ips",
21891
- "last_updated": "2024-12-02T22:09:08.418059",
21896
+ "last_updated": "2024-12-03T00:40:31.877348",
21892
21897
  "name": "Cloudflare",
21893
21898
  "provider_type": "cdn",
21894
21899
  "regexes": {
@@ -22090,7 +22095,7 @@
22090
22095
  "cloudfront.net"
22091
22096
  ],
22092
22097
  "ips_url": "https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips",
22093
- "last_updated": "2024-12-02T22:09:09.451540",
22098
+ "last_updated": "2024-12-03T00:40:32.601213",
22094
22099
  "name": "Cloudfront",
22095
22100
  "provider_type": "cdn",
22096
22101
  "regexes": {}
@@ -23252,7 +23257,7 @@
23252
23257
  "nginxconfig.io"
23253
23258
  ],
23254
23259
  "ips_url": "https://digitalocean.com/geo/google.csv",
23255
- "last_updated": "2024-12-02T22:09:08.992128",
23260
+ "last_updated": "2024-12-03T00:40:32.127038",
23256
23261
  "name": "DigitalOcean",
23257
23262
  "provider_type": "cloud",
23258
23263
  "regexes": {
@@ -23294,7 +23299,7 @@
23294
23299
  "zencdn.net"
23295
23300
  ],
23296
23301
  "ips_url": "https://api.fastly.com/public-ip-list",
23297
- "last_updated": "2024-12-02T22:09:08.888651",
23302
+ "last_updated": "2024-12-03T00:40:31.075513",
23298
23303
  "name": "Fastly",
23299
23304
  "provider_type": "cloud",
23300
23305
  "regexes": {}
@@ -28484,7 +28489,7 @@
28484
28489
  "github.com"
28485
28490
  ],
28486
28491
  "ips_url": "https://api.github.com/meta",
28487
- "last_updated": "2024-12-02T22:09:08.175743",
28492
+ "last_updated": "2024-12-03T00:40:31.874245",
28488
28493
  "name": "GitHub",
28489
28494
  "provider_type": "cdn",
28490
28495
  "regexes": {}
@@ -29219,7 +29224,7 @@
29219
29224
  "googleapis.com"
29220
29225
  ],
29221
29226
  "ips_url": "https://www.gstatic.com/ipranges/cloud.json",
29222
- "last_updated": "2024-12-02T22:09:07.655784",
29227
+ "last_updated": "2024-12-03T00:40:31.951862",
29223
29228
  "name": "Google",
29224
29229
  "provider_type": "cloud",
29225
29230
  "regexes": {
@@ -29708,7 +29713,7 @@
29708
29713
  "your-server.de"
29709
29714
  ],
29710
29715
  "ips_url": "",
29711
- "last_updated": "2024-12-02T22:09:06.538460",
29716
+ "last_updated": "2024-12-03T00:40:29.953743",
29712
29717
  "name": "Hetzner",
29713
29718
  "provider_type": "cloud",
29714
29719
  "regexes": {
@@ -29753,7 +29758,7 @@
29753
29758
  "imperva.com"
29754
29759
  ],
29755
29760
  "ips_url": "https://my.imperva.com/api/integration/v1/ips",
29756
- "last_updated": "2024-12-02T22:09:08.177061",
29761
+ "last_updated": "2024-12-03T00:40:32.019759",
29757
29762
  "name": "Imperva",
29758
29763
  "provider_type": "cdn",
29759
29764
  "regexes": {}
@@ -30540,7 +30545,7 @@
30540
30545
  "sun.com"
30541
30546
  ],
30542
30547
  "ips_url": "https://docs.oracle.com/en-us/iaas/tools/public_ip_ranges.json",
30543
- "last_updated": "2024-12-02T22:09:09.044845",
30548
+ "last_updated": "2024-12-03T00:40:32.014654",
30544
30549
  "name": "Oracle",
30545
30550
  "provider_type": "cloud",
30546
30551
  "regexes": {}
@@ -30621,7 +30626,7 @@
30621
30626
  "zohowebstatic.com"
30622
30627
  ],
30623
30628
  "ips_url": "",
30624
- "last_updated": "2024-12-02T22:08:53.199121",
30629
+ "last_updated": "2024-12-03T00:40:16.300539",
30625
30630
  "name": "Zoho",
30626
30631
  "provider_type": "cloud",
30627
30632
  "regexes": {}
@@ -8,9 +8,7 @@ from cloudcheck.providers import cloud_providers
8
8
  async def _main():
9
9
  ips = sys.argv[1:]
10
10
  if not ips:
11
- print(
12
- "usage: cloudcheck 1.2.3.4 [update | forceupdate | [ips...] | [domains...]]"
13
- )
11
+ print("usage: cloudcheck 1.2.3.4 [update | forceupdate | [ips...] | [domains...]]")
14
12
  elif len(ips) == 1 and ips[0].lower() == "update":
15
13
  await cloud_providers.update()
16
14
  return
@@ -9,7 +9,7 @@ def is_ip_type(i):
9
9
 
10
10
  def make_ip_type(host):
11
11
  if not host:
12
- raise ValueError(f"Invalid host")
12
+ raise ValueError("Invalid host")
13
13
  try:
14
14
  host = ipaddress.ip_network(host, strict=False)
15
15
  except Exception:
@@ -23,11 +23,7 @@ for file in Path(__file__).parent.glob("*.py"):
23
23
  module_variables = importlib.import_module(import_path, "cloudcheck")
24
24
  for variable in module_variables.__dict__.keys():
25
25
  value = getattr(module_variables, variable)
26
- if (
27
- hasattr(value, "__mro__")
28
- and not value == BaseCloudProvider
29
- and BaseCloudProvider in value.__mro__
30
- ):
26
+ if hasattr(value, "__mro__") and not value == BaseCloudProvider and BaseCloudProvider in value.__mro__:
31
27
  provider_name = value.__name__.lower()
32
28
  providers[provider_name] = value
33
29
 
@@ -103,9 +99,7 @@ class CloudProviders:
103
99
  if self.last_updated > oldest_allowed and not force:
104
100
  return
105
101
  try:
106
- async with httpx.AsyncClient(
107
- transport=httpx.AsyncHTTPTransport(verify=False)
108
- ) as client:
102
+ async with httpx.AsyncClient(transport=httpx.AsyncHTTPTransport(verify=False)) as client:
109
103
  response = await client.get(self.json_url)
110
104
  except Exception as e:
111
105
  error = e
@@ -113,10 +107,10 @@ class CloudProviders:
113
107
  with open(self.json_path, "wb") as f:
114
108
  f.write(response.content)
115
109
  self.load_from_json(force=True)
110
+ for provider in self:
111
+ provider.radix.defrag()
116
112
  else:
117
- log.warning(
118
- f"Failed to retrieve update from {self.json_url} (response: {response}, error: {error})"
119
- )
113
+ log.warning(f"Failed to retrieve update from {self.json_url} (response: {response}, error: {error})")
120
114
 
121
115
  async def update_from_sources(self):
122
116
  tasks = [asyncio.create_task(p.update()) for p in self]
@@ -124,9 +118,7 @@ class CloudProviders:
124
118
  j = self.to_json()
125
119
  if j:
126
120
  with open(self.json_path, "w") as f:
127
- json.dump(
128
- self.to_json(), f, sort_keys=True, indent=4, cls=CustomJSONEncoder
129
- )
121
+ json.dump(self.to_json(), f, sort_keys=True, cls=CustomJSONEncoder)
130
122
  self.load_from_json(force=True)
131
123
 
132
124
  def to_json(self):
@@ -47,11 +47,7 @@ class Amazon(BaseCloudProvider):
47
47
  "thinkboxsoftware.com",
48
48
  ]
49
49
  bucket_name_regex = r"[a-z0-9_][a-z0-9-\.]{1,61}[a-z0-9]"
50
- regexes = {
51
- "STORAGE_BUCKET": [
52
- r"(" + bucket_name_regex + r")\.(s3-?(?:[a-z0-9-]*\.){1,2}amazonaws\.com)"
53
- ]
54
- }
50
+ regexes = {"STORAGE_BUCKET": [r"(" + bucket_name_regex + r")\.(s3-?(?:[a-z0-9-]*\.){1,2}amazonaws\.com)"]}
55
51
 
56
52
  ips_url = "https://ip-ranges.amazonaws.com/ip-ranges.json"
57
53
 
@@ -144,11 +144,11 @@ class Azure(BaseCloudProvider):
144
144
  "windowsazurestatus.cn",
145
145
  ]
146
146
  bucket_name_regex = r"[a-z0-9][a-z0-9-_\.]{1,61}[a-z0-9]"
147
- regexes = {
148
- "STORAGE_BUCKET": [r"(" + bucket_name_regex + r")\.(blob\.core\.windows\.net)"]
149
- }
147
+ regexes = {"STORAGE_BUCKET": [r"(" + bucket_name_regex + r")\.(blob\.core\.windows\.net)"]}
150
148
 
151
- ips_url = "https://download.microsoft.com/download/0/1/8/018E208D-54F8-44CD-AA26-CD7BC9524A8C/PublicIPs_20200824.xml"
149
+ ips_url = (
150
+ "https://download.microsoft.com/download/0/1/8/018E208D-54F8-44CD-AA26-CD7BC9524A8C/PublicIPs_20200824.xml"
151
+ )
152
152
 
153
153
  def parse_response(self, response):
154
154
  ranges = set()
@@ -66,9 +66,7 @@ class BaseCloudProvider:
66
66
  self.radix = Target()
67
67
  if j is not None:
68
68
  p = CloudProviderJSON(**j)
69
- self.update_domains(
70
- [d.lower() for d in set(list(self.domains) + list(p.domains))]
71
- )
69
+ self.update_domains([d.lower() for d in set(list(self.domains) + list(p.domains))])
72
70
  self.update_ranges(p.cidrs)
73
71
  self.last_updated = p.last_updated
74
72
 
@@ -95,9 +93,7 @@ class BaseCloudProvider:
95
93
  try:
96
94
  self.ranges = self.get_subnets()
97
95
  if self.ips_url:
98
- async with httpx.AsyncClient(
99
- transport=httpx.AsyncHTTPTransport(verify=False)
100
- ) as client:
96
+ async with httpx.AsyncClient(transport=httpx.AsyncHTTPTransport(verify=False)) as client:
101
97
  response = await client.get(
102
98
  self.ips_url,
103
99
  follow_redirects=True,
@@ -12,11 +12,7 @@ class DigitalOcean(BaseCloudProvider):
12
12
  ]
13
13
 
14
14
  bucket_name_regex = r"[a-z0-9][a-z0-9-]{2,62}"
15
- regexes = {
16
- "STORAGE_BUCKET": [
17
- r"(" + bucket_name_regex + r")\.([a-z]{3}[\d]{1}\.digitaloceanspaces\.com)"
18
- ]
19
- }
15
+ regexes = {"STORAGE_BUCKET": [r"(" + bucket_name_regex + r")\.([a-z]{3}[\d]{1}\.digitaloceanspaces\.com)"]}
20
16
 
21
17
  ips_url = "https://digitalocean.com/geo/google.csv"
22
18
 
@@ -31,7 +31,7 @@ async def test_cloudcheck():
31
31
 
32
32
  google = cloud_providers.providers["google"]
33
33
  assert google.check("test.asdf.google") == "google"
34
- assert google.check("test.asdf.google.asdf") == None
34
+ assert google.check("test.asdf.google.asdf") is None
35
35
 
36
36
  assert cloud_providers.check("asdf.google") == [("Google", "cloud", "google")]
37
37
  assert cloud_providers.check("asdf.googles") == []
@@ -72,7 +72,6 @@ async def test_cloudcheck():
72
72
 
73
73
  @pytest.mark.asyncio
74
74
  async def test_cloudcheck_cli(monkeypatch, capsys):
75
-
76
75
  from cloudcheck.cloudcheck import _main
77
76
 
78
77
  monkeypatch.setattr(sys, "exit", lambda *args, **kwargs: True)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cloudcheck"
3
- version = "6.0.0.686"
3
+ version = "v7.0.694"
4
4
  description = "Check whether an IP address belongs to a cloud provider"
5
5
  authors = ["TheTechromancer"]
6
6
  license = "GPL-3.0"
@@ -16,19 +16,27 @@ homepage = "https://github.com/blacklanternsecurity/cloudcheck"
16
16
  [tool.poetry.scripts]
17
17
  cloudcheck = 'cloudcheck.cloudcheck:main'
18
18
 
19
+ [tool.ruff]
20
+ line-length = 119
21
+ lint.ignore = ["E402", "E721", "E741", "F401", "F403", "F405", "E713"]
22
+
19
23
  [tool.poetry.dependencies]
20
24
  python = "^3.9"
21
25
  pydantic = "^2.4.2"
22
26
  httpx = ">=0.26,<0.29"
23
27
  regex = "^2024.4.16"
24
- radixtarget = "^2.0.0.32"
28
+ radixtarget = "^3.0.13"
25
29
 
26
30
  [tool.poetry.group.dev.dependencies]
27
- black = ">=22.12,<25.0"
28
- flake8 = ">=6.1,<8.0"
29
31
  pytest-asyncio = ">=0.21.1,<0.25.0"
30
32
  pytest = "^8.1.1"
33
+ ruff = "^0.8.1"
31
34
 
32
35
  [build-system]
33
- requires = ["poetry-core"]
34
- build-backend = "poetry.core.masonry.api"
36
+ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
37
+ build-backend = "poetry_dynamic_versioning.backend"
38
+
39
+ [tool.poetry-dynamic-versioning]
40
+ enable = false
41
+ metadata = false
42
+ format-jinja = 'v7.0.{{ distance }}'
File without changes