Skip to content

Commit 4bc22e2

Browse files
authored
Merge pull request #271 from blacklanternsecurity/dev
11.0 release
2 parents b895a4c + 2bc52de commit 4bc22e2

23 files changed

Lines changed: 351 additions & 290 deletions

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- name: Generate token from GitHub App
1717
id: app-token
18-
uses: actions/create-github-app-token@v1
18+
uses: actions/create-github-app-token@v3
1919
with:
2020
app-id: ${{ secrets.APP_ID }}
2121
private-key: ${{ secrets.APP_PRIVATE_KEY }}

.github/workflows/daily-update.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ jobs:
1919
contents: write
2020

2121
steps:
22+
- name: Generate app token
23+
id: app-token
24+
uses: actions/create-github-app-token@v3
25+
with:
26+
app-id: ${{ secrets.CLOUDCHECK_APP_ID }}
27+
private-key: ${{ secrets.CLOUDCHECK_APP_PRIVATE_KEY }}
28+
2229
- name: Checkout stable branch
2330
uses: actions/checkout@v6
2431
with:
2532
ref: stable
33+
token: ${{ steps.app-token.outputs.token }}
2634

2735
- name: Set up Python
2836
uses: actions/setup-python@v6

.github/workflows/docker-tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
pip install requests
2727
2828
- name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v3
29+
uses: docker/setup-buildx-action@v4
3030

3131
- name: Run Docker tests
3232
run: |
@@ -42,30 +42,30 @@ jobs:
4242
uses: actions/checkout@v6
4343

4444
- name: Set up Docker Buildx
45-
uses: docker/setup-buildx-action@v3
45+
uses: docker/setup-buildx-action@v4
4646

4747
- name: Log in to Docker Hub
48-
uses: docker/login-action@v3
48+
uses: docker/login-action@v4
4949
with:
5050
username: blacklanternsecurity
5151
password: ${{ secrets.DOCKER_TOKEN }}
5252

5353
- name: Extract metadata
5454
id: meta
55-
uses: docker/metadata-action@v5
55+
uses: docker/metadata-action@v6
5656
with:
5757
images: blacklanternsecurity/cloudcheck
5858
tags: |
5959
type=ref,event=branch
6060
type=ref,event=pr
6161
type=sha,prefix=sha-
6262
type=raw,value=latest,enable={{is_default_branch}}
63-
type=raw,value=v9
64-
type=raw,value=v9.2
65-
type=raw,value=v9.2.0
63+
type=raw,value=v11
64+
type=raw,value=v11.0
65+
type=raw,value=v11.0.0
6666
6767
- name: Build and push Docker image
68-
uses: docker/build-push-action@v6
68+
uses: docker/build-push-action@v7
6969
with:
7070
context: .
7171
file: ./Dockerfile

.github/workflows/python-tests.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
18+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1919

2020
steps:
2121
- uses: actions/checkout@v6
@@ -47,8 +47,19 @@ jobs:
4747
runs-on: ubuntu-latest
4848
needs: test
4949
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
50+
permissions:
51+
contents: write
5052
steps:
53+
- name: Generate app token
54+
id: app-token
55+
uses: actions/create-github-app-token@v3
56+
with:
57+
app-id: ${{ secrets.CLOUDCHECK_APP_ID }}
58+
private-key: ${{ secrets.CLOUDCHECK_APP_PRIVATE_KEY }}
5159
- uses: actions/checkout@v6
60+
with:
61+
fetch-depth: 0
62+
token: ${{ steps.app-token.outputs.token }}
5263
- name: Set up Python
5364
uses: actions/setup-python@v6
5465
with:
@@ -57,10 +68,33 @@ jobs:
5768
uses: dtolnay/rust-toolchain@stable
5869
- name: Set up uv
5970
uses: astral-sh/setup-uv@v7
71+
- name: Get current version
72+
id: get_version
73+
run: |
74+
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
75+
echo "VERSION=v${VERSION}" >> $GITHUB_OUTPUT
76+
- name: Check for version change
77+
id: version_check
78+
run: |
79+
git fetch --tags
80+
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "none")
81+
CURRENT="${{ steps.get_version.outputs.VERSION }}"
82+
if [ "$LATEST_TAG" = "$CURRENT" ]; then
83+
echo "changed=false" >> $GITHUB_OUTPUT
84+
else
85+
echo "changed=true" >> $GITHUB_OUTPUT
86+
fi
6087
- name: Build PyPi package
6188
run: uv run maturin build --release --out dist
6289
- name: Publish PyPi package
6390
run: uv run maturin publish --skip-existing --username __token__ --password ${{ secrets.PYPI_TOKEN }}
91+
- name: Tag release
92+
if: steps.version_check.outputs.changed == 'true'
93+
run: |
94+
git config user.name "github-actions[bot]"
95+
git config user.email "github-actions[bot]@users.noreply.github.com"
96+
git tag -a "${{ steps.get_version.outputs.VERSION }}" -m "Release ${{ steps.get_version.outputs.VERSION }}"
97+
git push origin "refs/tags/${{ steps.get_version.outputs.VERSION }}"
6498
linux:
6599
runs-on: ${{ matrix.platform.runner }}
66100
needs: publish
@@ -107,7 +141,7 @@ jobs:
107141
exit 1
108142
fi
109143
- name: Upload wheels
110-
uses: actions/upload-artifact@v6
144+
uses: actions/upload-artifact@v7
111145
with:
112146
name: wheels-linux-${{ matrix.platform.target }}
113147
path: dist
@@ -157,7 +191,7 @@ jobs:
157191
fi
158192
159193
- name: Upload wheels
160-
uses: actions/upload-artifact@v6
194+
uses: actions/upload-artifact@v7
161195
with:
162196
name: wheels-musllinux-${{ matrix.platform.target }}
163197
path: dist
@@ -186,7 +220,7 @@ jobs:
186220
args: --release --out dist --find-interpreter
187221
sccache: false
188222
- name: Upload wheels
189-
uses: actions/upload-artifact@v6
223+
uses: actions/upload-artifact@v7
190224
with:
191225
name: wheels-windows-${{ matrix.platform.target }}
192226
path: dist
@@ -214,7 +248,7 @@ jobs:
214248
args: --release --out dist --find-interpreter
215249
sccache: false
216250
- name: Upload wheels
217-
uses: actions/upload-artifact@v6
251+
uses: actions/upload-artifact@v7
218252
with:
219253
name: wheels-macos-${{ matrix.platform.target }}
220254
path: dist
@@ -231,7 +265,7 @@ jobs:
231265
command: sdist
232266
args: --out dist
233267
- name: Upload sdist
234-
uses: actions/upload-artifact@v6
268+
uses: actions/upload-artifact@v7
235269
with:
236270
name: wheels-sdist
237271
path: dist
@@ -249,9 +283,9 @@ jobs:
249283
# Used to generate artifact attestation
250284
attestations: write
251285
steps:
252-
- uses: actions/download-artifact@v7
286+
- uses: actions/download-artifact@v8
253287
- name: Generate artifact attestation
254-
uses: actions/attest-build-provenance@v3
288+
uses: actions/attest-build-provenance@v4
255289
with:
256290
subject-path: 'wheels-*/*'
257291
- name: Publish to PyPI

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
# Python
66
__pycache__/
7+
*.so

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloudcheck"
3-
version = "10.0.1"
3+
version = "11.0.0"
44
edition = "2024"
55
description = "CloudCheck is a simple Rust tool to check whether an IP address or hostname belongs to a cloud provider."
66
license = "GPL-3.0"

cloudcheck/helpers.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ipaddress
22
import os
33
import sys
4-
import httpx
54
from pathlib import Path
65
from typing import List, Set, Union
76

@@ -204,8 +203,16 @@ def strings_to_cidrs(
204203
}
205204

206205

206+
_client = None
207+
208+
207209
def request(url, include_api_key=False, browser_headers=False, timeout=60, **kwargs):
208-
global _warned_missing_api_key
210+
import asyncio
211+
import blasthttp
212+
213+
global _warned_missing_api_key, _client
214+
if _client is None:
215+
_client = blasthttp.BlastHTTP()
209216
headers = kwargs.get("headers", {})
210217
if browser_headers:
211218
headers.update(browser_base_headers)
@@ -221,10 +228,15 @@ def request(url, include_api_key=False, browser_headers=False, timeout=60, **kwa
221228
"running the update.",
222229
file=sys.stderr,
223230
)
224-
kwargs["headers"] = headers
231+
kwargs["headers"] = list(headers.items())
225232
kwargs["timeout"] = timeout
226233
kwargs.setdefault("follow_redirects", True)
227-
return httpx.get(url, **kwargs)
234+
kwargs.setdefault("verify_certs", True)
235+
236+
async def _send():
237+
return await _client.request(url, **kwargs)
238+
239+
return asyncio.run(_send())
228240

229241

230242
def parse_v2fly_domain_file(file_path: Path) -> Set[str]:

cloudcheck/providers/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def fetch_org_ids(
222222

223223
def fetch_asns(self) -> List[Union[ipaddress.IPv4Network, ipaddress.IPv6Network]]:
224224
"""Fetch CIDRs for a given list of ASNs from ASNDB."""
225-
cidrs = []
225+
cidrs = set()
226226
errors = []
227227
print(f"Fetching {len(self.asns)} ASNs for {self.name}")
228228
for asn in self.asns:

cloudcheck/providers/bunnycdn.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from cloudcheck.providers.base import BaseProvider
2+
from typing import List
3+
4+
5+
class Bunnycdn(BaseProvider):
6+
tags: List[str] = ["cdn"]
7+
short_description: str = "Bunny CDN"
8+
long_description: str = "A global content delivery network and edge platform."
9+
# {"org_id": "ORG-BISD2-RIPE", "org_name": "BUNNYWAY, informacijske storitve d.o.o.", "country": "SI", "asns": [200325]}
10+
asns: List[int] = [200325]
11+
org_ids: List[str] = [
12+
"ORG-BISD2-RIPE",
13+
]

0 commit comments

Comments
 (0)