Purpose To make a cloudflare challenge pass successfully, Can be use cf_clearance bypassed by cloudflare

Overview

cf_clearance

Reference from playwright_stealth and undetected-chromedriver

Purpose To make a cloudflare 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.

Install

$ pip install cf_clearance

Usage

sync

from playwright.sync_api import sync_playwright
from cf_clearance import sync_retry, stealth_sync

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    stealth_sync(page)
    page.goto('https://nowsecure.nl')
    res = sync_retry(page)
    if res:
        cppkies = page.context.cookies()
        for cookie in cppkies:
            if cookie.get('name') == 'cf_clearance':
                print(cookie.get('value'))
        ua = page.evaluate('() => {return navigator.userAgent}')
        print(ua)
    else:
        print("fail")
    browser.close()

async

import asyncio
from playwright.async_api import async_playwright
from cf_clearance import async_retry, stealth_async

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await stealth_async(page)
        await page.goto('https://nowsecure.nl')
        res = await async_retry(page)
        if res:
            cppkies = await page.context.cookies()
            for cookie in cppkies:
                if cookie.get('name') == 'cf_clearance':
                    print(cookie.get('value'))
            ua = await page.evaluate('() => {return navigator.userAgent}')
            print(ua)
        else:
            print("fail")
        await browser.close()


asyncio.get_event_loop().run_until_complete(main())
Comments
  • how to use in Doker ?  got a timeout with example

    how to use in Doker ? got a timeout with example

    0.28.3 in an ubnutu 20.04 TLS server with docker I can open https://nowsecure.nl via curl

    curl http://localhost:8000/challenge -H "Content-Type:application/json" -X POST -d '{ "timeout":40, "url": "https://nowsecure.nl"}'

    got

    {"success":false,"msg":"challenge timeout","user_agent":null,"cookies":null}

    opened by bigqiao 5
  • how to use in Doker ? More doc pls

    how to use in Doker ? More doc pls

    curl http://localhost:8000/challenge -H "Content-Type:application/json" -X POST -d '{"proxy": {"server": "socks5://localhost:38080"}, "timeout":20, "url": "https://chat.openai.com/chat"}'

    {"success":true,"msg":"cf challenge success","user_agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36","cookies":{"cf_clearance":"mwV29nkv5mXzyvyvZ.aqgn59rL.hn_NunwUjp9g9tn0-1670827806-0-160","__Host-next-auth.csrf-token":"e64048d7560707f3fc484abbe15fdc72c4fa170fd53f3af8a769d06221fa5dac%7C0b483ae212fb5c8cf8794bef893c8a0626b3eb8b367ac16521dccf8c56d9d0ed","__Secure-next-auth.callback-url":"https%3A%2F%2Fchat.openai.com","__cf_bm":"u3MNGV6m86Ib2GUndQcUA6MlAijvK6qc9ngGWROAhlo-1670827806-0-Abk+W9FPVBjwtOq+VlJKeOGq5S7Xz/lQ9rTyzY9p9zUxz2bpM8Guiza56AJYIydDI97ESDSt/1/NiPOxVVLpWUQ="}}

    opened by PlexPt 5
  • Can't use latest docker image

    Can't use latest docker image

    curl http://127.0.0.1:8000/challenge -H "Content-Type:application/json" -X POST \
          -d '{"timeout":20, "url": "https://nowsecure.nl"}' -v
    
    

    Note: Unnecessary use of -X or --request, POST is already inferred.

    • Trying 127.0.0.1:8000...
    • Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)

    POST /challenge HTTP/1.1 Host: 127.0.0.1:8000 User-Agent: curl/7.79.1 Accept: / Content-Type:application/json Content-Length: 45

    • Empty reply from server
    • Closing connection 0 curl: (52) Empty reply from server
    opened by ralfiannor 4
  • Bypass failed

    Bypass failed

    Some pages can be bypassed ,some not working image

        if browser is None:
            p = await async_playwright().start()
            browser = await p.chromium.launch(headless=False,
                                              channel='chrome',
                                              args=["--no-sandbox"])
        page = await context.new_page()
            await async_stealth(page, pure=True)
            await page.goto(url, timeout=0)
            res = await async_cf_retry(page)
            await page.wait_for_timeout(1000 * 2)
    ``
    opened by jw-star 3
  • Thank you.

    Thank you.

    With CloudFlare adding H Captcha, it completely broke my code and I couldn't find a solution until I found a github page with 10 stars.

    This is some great code on your part. Thank you for making this free publicly available code, it is highly appreciated!!! <3

    opened by tcrch 3
  • adopt FlareSolverr style

    adopt FlareSolverr style

    Please I want to use it like docker run -d
    --name=flaresolverr
    -p 8191:8191
    -e LOG_LEVEL=info
    --restart unless-stopped
    ghcr.io/flaresolverr/flaresolverr:latest

    and

    curl -L -X POST 'http://localhost:8191/v1'
    -H 'Content-Type: application/json'
    --data-raw '{ "cmd": "request.get", "url":"http://www.google.com/", "maxTimeout": 60000 }'

    FlareSolverr Doesnt support user-proxy auth :(

    opened by sneedgers 2
  • SOCKSHTTPSConnectionPool(host='nowsecure.nl', port=443)

    SOCKSHTTPSConnectionPool(host='nowsecure.nl', port=443)

    Hello thanks for your great work but i try now use test idea and have this error:

    requests.exceptions.ConnectionError: SOCKSHTTPSConnectionPool(host='nowsecure.nl', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x110996730>: Failed to establish a new connection: [Errno 61] Connection refused'))

    I have one file proxies.txt

    thanks

    opened by reactiver001 1
  • cannot import name 'sync_retry' from 'cf_clearance'

    cannot import name 'sync_retry' from 'cf_clearance'

    Hi, I'm getting that error. im trying to run the example script:

    from playwright.sync_api import sync_playwright
    from cf_clearance import sync_retry, stealth_sync
    import requests
    

    ImportError: cannot import name 'sync_retry' from 'cf_clearance'

    opened by jhuaraya 1
  • refactor: optimization

    refactor: optimization

    Changed sleep position and counter position

    Unwanted exception handling removed in Docker's server.py, changed to return all retrieved cookies You assigned the correct status code to the response you want to return on error

    opened by KohnoseLami 0
Releases(v0.28.3)
A tool written in Python used to instalock agents in VALORANT using the local API.

Valorant Instalock Tool v2.1.0 by Mr. SOSA A tool written in Python used to instalock agents in VALORANT using the local API. This is NOT a hotkey pro

Mr. SOSA 3 Nov 18, 2021
MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

Project MONAI 49 Dec 23, 2022
0-1 knapsack with an additional constraint of maximum number of items used

extended_knapsack 0-1 knapsack with an additional constraint of maximum number of items used. Usage pip3 install extended_knapsack from extended_knaps

Lion Ralfs 1 Jan 06, 2022
A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats.

VC UserBot A Telegram Userbot to play Audio and Video songs / files in Telegram Voice Chats. It's made with PyTgCalls and Pyrogram Requirements Python

조던 1 Nov 29, 2021
TeamDltvideo Bot you can add in your Telegram Group Thanks

TeamDltvideo TeamDltvideo Bot you can add in your Telegram Group Thanks Video Stream is a telegram bot project that's allow you to play video on teleg

TeamDlt 1 Nov 18, 2021
A simpler way to make forms, surveys, and reaction input using discord.py.

discord-ext-forms An easier way to make forms and surveys in discord.py. This module is a very simple way to ask questions and create complete forms i

thrizzle 16 Nov 06, 2022
Amazon AWS Web Tool (view only)

Amazon AWS Web Tool (AAWT) discontinued Features Cloudfront (simple) EC2 (With Charts and Prices) EC2 Reserved EBS ELB (With Charts) Obs:. only classi

Carlos Augusto Malucelli 9 Nov 07, 2022
Sie_banxico - A python class for the Economic Information System (SIE) API of Banco de México

sie_banxico A python class for the Economic Information System (SIE) API of Banco de México. Args: token (str): A query token from Banco de México id_

Dillan 2 Apr 07, 2022
MSE5050/7050 Materials Informatics course at the University of Utah

MaterialsInformatics MSE5050/7050 Materials Informatics course at the University of Utah This github repo contains coursework content such as class sl

41 Dec 30, 2022
light wrapper for indeed.com api

Simple wrapper for indeed api. go to indeed.com - register for api publisher token example from indeed import IndeedApi token = 'your token' api =

16 Sep 21, 2022
A simple Python API wrapper for Cloudflare Stream's API.

python-cloudflare-stream A basic Python API wrapper for working with Cloudflare Stream. Arbington.com started off using Cloudflare Stream. We used the

Arbington 3 Sep 08, 2022
Battle Pass farming tft bot

Tft bot Bot para farmar pontos do Passe de Batalha do TFT Descrição A cada partida de tft jogada você ganha 100 pontos no passe, porém você não precis

Leonardo Gonçalves 4 Jan 27, 2022
Pythonic and easy iCalendar library (rfc5545)

ics.py 0.8.0-dev : iCalendar for Humans Original repository (GitHub) - Bugtracker and issues (GitHub) - PyPi package (ics) - Documentation (Read The D

ics.py 513 Jan 02, 2023
Upload comma-delimited files to biglocalnews.org in your GitHub Action

Upload comma-delimited files to biglocalnews.org in your GitHub Action Inputs api-key: Your biglocalnews.org API token. project-id: The identifier of

biglocalnews 1 Apr 20, 2022
A webhook API for Discord.

Webhook API A webhook API for Discord. Requirements requests Usage

1 Feb 08, 2022
A Telegram bot for playing Trop Bon Cadavre.

Trop Bon Cadavre A Telegram bot for playing Trop Bon Cadavre (english: very good corpse), a game freely adapted from the french Cadavre exquis. A game

4 Oct 26, 2021
A Rich renderable for viewing Multiple Sequence Alignments in the terminal.

rich-msa A simple module to render colorful Multiple Sequence Alignment with rich in the terminal. 🔧 Installing Install the rich-msa package directly

Martin Larralde 64 Dec 04, 2022
The Foursquare API client for Python

foursquare Python client for the foursquare API. Philosophy: Map foursquare's endpoints one-to-one Clean, simple, Pythonic calls Only handle raw data,

Mike Lewis 400 Dec 19, 2022
ABACUS Aroio API for Webinterfaces and App-Connections

ABACUS Aroio API for Webinterfaces and App-Connections Setup Start virtual python environment if you don't have python3 running setup: $ python3 -m ve

Abacus Aroio Developer Team 1 Apr 01, 2021
vk Bot because of which everyone will lag

VK-crash-bot open cmd and write: "pip install vk-api" To configure the bot, you need to open main.py and set the value to such variables as "token" an

NotQuki 0 Jun 05, 2022