cf-clearance
Purpose To make a cloudflare v2 challenge pass successfully, Can be use cf_clearance bypassed by cloudflare, However, with the cf_clearance, make sure you use the same IP and UA as when you got it.
Project Pass Challenge Status
Warning
If you use chromium, Please use interface mode, You must add headless=False. If you use it on linux or docker, use XVFB.
If you use firefox you don't need interface mode and XVFB.
Challenge are not always successful. Please try more and handle exceptions.
Docker Usage
Recommended to install using Docker container on Ubuntu server.
DockerHub => https://hub.docker.com/r/vvanglro/cf-clearance
docker run -d --restart always --network host --name cf-clearance vvanglro/cf-clearance:latest \
--host 0.0.0.0 --port 8000 --workers 1
curl http://localhost:8000/challenge -H "Content-Type:application/json" -X POST \
-d '{"proxy": {"server": "socks5://localhost:7890"}, "timeout":20, "url": "https://nowsecure.nl"}'
import requests
proxy = "socks5://localhost:7890"
resp = requests.post(
"http://localhost:8000/challenge",
json={
"proxy": {"server": proxy},
"timeout": 20,
"url": "https://nowsecure.nl",
"pure": True,
"browser": 2,
"cookies": [
{
"url": "https://www.example.com",
"name": "example-cookie",
"value": "example-value",
}
],
"headers": {"example-ua": "example-ua-value"},
"exec_js": "() => {return navigator.userAgent}",
},
)
data = resp.json()
# In some cases, the cloudflare challenge will not be triggered,
# so when cf in the return parameter is true, it means that the challenge has been encountered.
if data.get("success") and data.get("cf"):
ua = data.get("user_agent")
exec_js_resp = data.get("exec_js_resp")
cf_clearance_value = data.get("cookies").get("cf_clearance")
# use cf_clearance, must be same IP and UA
headers = {"user-agent": ua}
cookies = {"cf_clearance": cf_clearance_value}
res = requests.get(
"https://nowsecure.nl", proxies={"all": proxy}, headers=headers, cookies=cookies
)
if "<title>Just a moment...</title>" not in res.text:
print("cf challenge success")
Install
pip install cf-clearance
Usage
Please make sure it is the latest package. See example.
pip install --upgrade cf-clearance
or
pip install git+https://github.com/vvanglro/cf-clearance.git@main
Install Playwright Depends
playwright install chromium firefox
Metadata
Release files for cf_clearance 0.31.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cf_clearance-0.31.0.tar.gz | 12.9 kB | Without provenance | Details for cf_clearance-0.31.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cf_clearance-0.31.0-py3-none-any.whl | Python 3 | none | any | Details for cf_clearance-0.31.0-py3-none-any.whl |
Total release size: 27.3 kB
Release files / cf_clearance-0.31.0.tar.gz
| Download URL | cf_clearance-0.31.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8ab60505ce74509a977875e831ba52aa9cf8e5712f5840b8b9d6de9cd64d189
|
|
BLAKE2b-256 checksum How to use checksums |
222db6d3b6c9e9b5b14c7576f6990c15f3383bf8bbf929030b60aa81d971f4ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.8.0 CPython/3.11.4
|
Release files / cf_clearance-0.31.0-py3-none-any.whl
| Download URL | cf_clearance-0.31.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c40521fc0a2f768e4b0865ea3d546e0b217323a2a7053c4b9875008cdd172bce
|
|
BLAKE2b-256 checksum How to use checksums |
0964aef2e1cf3f2b3577333b2719d7986c5d91532e6f97339f038b18d34a813e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.8.0 CPython/3.11.4
|
Security for cf_clearance 0.31.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.