URL scanning API using Cloudflare URL Scanner. It allows you to submit URLs to be scanned and retrieve results (verdicts, metadata, contacted domains, etc.).
The repository is available here. You only need to create a .env file with your Cloudflare API token and account ID.
CLOUDFLARE_API_TOKEN=your_api_token
CLOUDFLARE_ACCOUNT_ID=your_account_idAnd then run the following command:
docker compose up --buildThe repository is built with the following technologies: Node.js + Express.
The repository is organized as follows:
poc-cloudflare-url-scanner/
|-- src/
| |-- index.js
| |-- cloudflare.js
| |-- routes/
| |-- scan.js
|-- .env.example
|-- .env
|-- package.json
|-- README.mdYou can create a Cloudflare API token in the Cloudflare dashboard. You need to create a token with the following permissions:
You can up and running the API by cloning this repository and running the following command:
docker compose up --buildYou can use the API by sending a POST request to the /scan endpoint with the URL you want to scan.
curl -X POST -H "Content-Type: application/json" -d '{"url":"https://example.com"}' http://localhost:3000/scanThe response will be a JSON object with the scan result.
{
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"url": "https://example.com",
"message": "Submission successful",
"resultUrl": "https://api.cloudflare.com/.../result/095be615-..."
}The uuid is the UUID of the scan. You can use it to get the scan result.
curl -s "http://localhost:3000/scan/095be615-a8ad-4c33-8e9c-c7612fbf6c9f" | jq .Useful attributes of the scan result are:
{
...,
"verdicts": {
"overall": {
"malicious": false,
"hasVerdicts": false,
"categories": [],
"tags": []
}
},
...
}Now you can know the verdict of the scan.