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)
StringSessionGenerator - A Telegram bot to generate pyrogram and telethon string session

⭐️ String Session Generator ⭐️ Genrate String Session Using this bot. Made by TeamUltronX 🔥 String Session Demo Bot: Environment Variables Mandatory

TheUltronX 1 Dec 31, 2021
This Lambda will Pull propagated routes from TGW and update VPC route table

AWS-Transitgateway-Route-Propagation This Lambda will Pull propagated routes from TGW and update VPC route table. Tested on python 3.8 Lambda AWS INST

4 Jan 20, 2022
Telegram Voice-Chat Bot

Telegram Voice-Chat Bot [PyTGCalls] ⇝ Requirements ⇜ Account requirements A Telegram account to use as the music bot, You cannot use regular bot accou

1 Dec 03, 2021
WhatsApp Status Tracker With Python

Warning!! This Repo is Purly educational purpose Don't use this to stalk on others, which is subjective to crime Pre-Req: Telegram bot of your own wit

Vignesh Karunagaran 10 Dec 09, 2022
This is a Innexia Group Manager Bot with many features

⚡ Innexia ⚡ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... Available on Telegram as @Innexia ❤️ Suppor

TeamDeeCode 84 Jun 04, 2022
Python library for the DeepL language translation API.

The DeepL API is a language translation API that allows other computer programs to send texts and documents to DeepL's servers and receive high-quality translations. This opens a whole universe of op

DeepL 535 Jan 04, 2023
SEMID - OSINT module with lots of discord functions

SEMID Framework About Semid is a framework with different Discord functions and

Hima 20 Sep 23, 2022
WhatsApp Multi Device Client

WhatsApp Multi Device Client

23 Nov 18, 2022
API de mi aplicación de Biblioteca

BOOKSTORE API Instalación/Configuración Previo Es una buena idea crear un entorno virtual antes de instalar las dependencias. Puedes hacerlo con el si

Gabriel Morales 1 Jan 09, 2022
Simple stock price analytics

mune · Mune is an open source python web application built to analyze stocks, named after Homma Munehisa. Currently, the forecasting component is powe

Richard Hong 14 Aug 30, 2021
Shuffle and add items from jellyfin to mpd (use in tandem with jellyfin-mopidy and mpd-mopidy). Similar to ncmpcpp's "Add random" feature..

jellyshuf Essentially implements ncmpcpp's add random feature (default hotkey: `) through a script which grabs info from jellyfin api itself. jellyfin

Ethan Djeric 2 Dec 14, 2021
A bot written in python that send prefilled Google Forms. It supports multithreading for faster execution time.

GoogleFormsBot https://flassy.xyz https://github.com/Shawey/GoogleFormsBot Requirements: os (Default) ast (Default) threading (Default) configparser (

Shawey 1 Jul 10, 2022
[Multithreading] [Proxy - auto & infile]

Discord-Token-Generator-AutoCheck [Multithreading] [Proxy - auto & infile] How to install? pip install -r requirements.txt run generator.py with pytho

Chakeaw__ 3 Oct 17, 2021
Make WhatsApp ChatBot and use WhatsApp API to send the WhatsApp messages in python .

Ultramsg.com WhatsApp Bot using WhatsApp API and ultramsg Demo WhatsApp API ChatBot using Ultramsg API with python. Opportunities and tasks: The outpu

Ultramsg 64 Dec 29, 2022
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
Auto-updater for the Northstar Titanfall 2 client

northstar-updater Auto-updater for the Northstar Titanfall 2 client Usage Put the exe into your Titanfall 2 directory next to Titanfall2.exe Then, whe

7 Nov 25, 2022
Listen to the radio station from your favorite broadcast

Latest news Listen to the radio station from your favorite broadcast MyCroft Radio Skill for testing and copy at docker skill About Play regional radi

1 Dec 22, 2021
Discord bot for Shran development

shranbot A discord bot named Herbert West that will monitor the Shran development discord server. Using dotenv shranbot uses a .env file to load secre

Matt Williams 1 Jul 29, 2022
Utility for downloading fanfiction in bulk from the Archive of Our Own

What is this? This is a program intended to help you download fanfiction from the Archive of Our Own in bulk. This program is primarily intended to wo

73 Dec 30, 2022
A fork of discord.py

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of discord.py Please read the gi

1 Dec 19, 2021