Skip to main content

Cloudflare URL Scanner SDK

Project description

Cloudflare URL Scanner PY-SDK

Python SDK for the Cloudflare URL Scanner API. It provides a simple way to interact with the API and scan URLs for malware, phishing, and more. To better understand Internet usage around the world, use Cloudflare’s URL Scanner. With Cloudflare’s URL Scanner, you have the ability to investigate the details of a domain, IP, URL, or ASN. Cloudflare’s URL Scanner is available in the Security Center of the Cloudflare dashboard, Cloudflare Radar and the Cloudflare API.

Read more about the Cloudflare URL Scanner API here.

[!NOTE] This SDK is not an official Cloudflare product.

[!NOTE] By default, the report will have a Public visibility level, which means it will appear in the recent scans list and in search results. It will also include a single screenshot with desktop resolution.

Features

  • Scan a URL
  • Get the scan result
  • Search for a scan by hostname
  • Search for a scan by UUID
  • Many more
  • Async support

Installation

From pip:

pip install cloudflare-url-scanner

From github:

python -m pip install -U git+https://github.com/alexraskin/cloudflare-url-scan

From source:

git clone
cd cloudflare-url-scan
python -m pip install .

Usage

To make your first URL scan using the API, you must obtain a URL Scanner specific API token. Create a Custom Token with Account > URL Scanner in the Permissions group, and select Edit as the access level.

from cloudflare_scan import UrlScannerClient


cf_client = UrlScannerClient(
    cloudflare_api_key="", #or set the environment variable CLOUDFLARE_API_KEY
    cloudflare_account_id="", #or set the environment variable CLOUDFLARE_ACCOUNT_ID
)

# Scan a URL
scan = cf_client.scan("example.com")

# Get the scan result
result = scan.result

# Get the UUID of the scan
uuid = scan.uuid

# Get the screenshot of the scan
screenshot = cf_client.get_screen_shots(uuid, resolution="desktop")

# Get the HAR file of the scan
har = cf_client.get_har(uuid)

# Get the scan by UUID
scan = cf_client.get_scan(uuid)

Async Usage

from cloudflare_scan import AsyncClient
import asyncio

cf_client = AsyncClient(
    cloudflare_api_key="",
    cloudflare_account_id=""
    )

async def main():
    scan = await cf_client.scan("https://www.google.com")
    print(scan.result)
    print(scan.json)

asyncio.run(main())

License

MIT License [LICENSE]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudflarescan-0.3.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

cloudflarescan-0.3.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file cloudflarescan-0.3.0.tar.gz.

File metadata

  • Download URL: cloudflarescan-0.3.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for cloudflarescan-0.3.0.tar.gz
Algorithm Hash digest
SHA256 66cd35044311c97fb712bcc798edb5511177e6182781bc3b316d8bb7e7055baa
MD5 8cc2c53d18d580dbd0e905a6424def71
BLAKE2b-256 48bcfad1c940e64fec150cbdea89a2c1f462e44f45517e2794528abc368ca6f6

See more details on using hashes here.

File details

Details for the file cloudflarescan-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudflarescan-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f69fc490d11d83ba4e35a9c1dc74c3b9214d8fda3af0a7c454b677cc596dc76f
MD5 433def0dcf22d7fe001480bfbd470bd0
BLAKE2b-256 64e2329859c781c0451b3bcd4531d25d3a8b521bc88e0498f99cd81403d4dac3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page