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)
Fetch Flipkart product details including name, price, MRP and Stock details in general as well as specific to a pincode

Fetch Flipkart product details including name, price, MRP and Stock details in general as well as specific to a pincode

Vishal Das 6 Jul 11, 2022
Get random jokes bapack2 from jokes-bapack2-api

Random Jokes Bapack2 Get random jokes bapack2 from jokes-bapack2-api Requirements Python Requests HTTP library How to Run py random-jokes-bapack2.py T

Miftah Afina 1 Nov 18, 2021
Instagram GiftShop Scam Killer

Instagram GiftShop Scam Killer A basic tool for Windows which kills acess to any giftshop scam from Instagram. Protect your Instagram account from the

1 Mar 31, 2022
Rust UserBot, Telegram istifadəsini asanlaşdıran bir proyektdir.

RUST USERBOT 🇦🇿 Rust UserBot, Telegram istifadəsini asanlaşdıran bir proyektdir. Qurulum Heroku Serverə qurulum git clone https://github.com/rustres

1 Oct 25, 2021
PokemonGo-Bot - The Pokemon Go Bot, baking with community.

PokemonGo-Bot PokemonGo-Bot is a project created by the PokemonGoF team. Since no public API available for now, a patch to use HASH-Server was applied

3.8k Jan 08, 2023
A discord http interactions framework built on top of Sanic

snowfin An async discord http interactions framework built on top of Sanic Installing for now just install the package through pip via github # Unix b

kaj 13 Dec 15, 2022
A Telegram bot to transcribe audio, video and image into text.

Transcriber Bot A Telegram bot to transcribe audio, video and image into text. Deploy to Heroku Local Deploying Install the FFmpeg. Make sure you have

10 Dec 19, 2022
ChairBot is designed to be reliable, easy to use, and lightweight for every user, and easliy to code add-ons for ChairBot.

ChairBot is designed to be reliable, easy to use, and lightweight for every user, and easliy to code add-ons for ChairBot. Ready to see whats possible with ChairBot?

1 Nov 08, 2021
AminoLab Library For AminoApps using aminoapps.com/api

AminoLab AminoLab Api For AminoApps using aminoapps.com/api Installing pip install AminoLab Example #Login import AminoLab client = AminoLab.Client()

10 Sep 26, 2022
A WhatsApp Crashing Tool for Termux

CrashW A WhatsApp Crashing Tool For Termux Users Installing : apt update && apt upgrade -y pkg install python3 pkg install git git clone git://gith

Gokul Mahato 20 Dec 27, 2022
Visualização de dados do TaxiGov.

Visualização de dados do TaxiGov Este repositório apresenta uma visualização das corridas de táxi do programa TaxiGov do governo federal, realizadas n

Ministério da Economia do Brasil 5 Dec 20, 2022
A unified API wrapper for YouTube and Twitch chat bots.

Chatto A unified API wrapper for YouTube and Twitch chat bots. Contributing Chatto is open to contributions. To find out where to get started, have a

Ethan Henderson 5 Aug 01, 2022
Tomli is a Python library for parsing TOML. Tomli is fully compatible with TOML v1.0.0.

Tomli A lil' TOML parser Table of Contents generated with mdformat-toc Intro Installation Usage Parse a TOML string Parse a TOML file Handle invalid T

Taneli Hukkinen 313 Dec 26, 2022
News API consisting various sources from Tanzania

Tanzania News API News API consisting various sources from Tanzania. Fork the project Clone the project git clone https://github.com/username/news-a

Innocent Zenda 6 Oct 06, 2022
Actively maintained, pure Python wrapper for the Twitter API. Supports both normal and streaming Twitter APIs.

Twython Twython is a Python library providing an easy way to access Twitter data. Supports Python 3. It's been battle tested by companies, educational

Ryan McGrath 1.9k Jan 02, 2023
A Python library wrapping the iFixit (Dozuki) API.

A Python library wrapping the iFixit API. Status Working, but incomplete. Fully tested and documented. Hacking I highly recommend using virtualenv: [$

James Pearson Hughes 13 May 24, 2021
Stock trading bot made using the Robinhood API / Python library...

High-Low Stock trading bot made using the Robinhood API / Python library... Index Installation Use Development Notes Installation To Install and run t

Reed Graff 1 Jan 07, 2022
Bot made by BLACKSTORM[BM] Contact Us - t.me/BLACKSTORM18

ᴡʜᴀᴛ ɪs ᴊᴀʀᴠɪs sᴇᴄᴜʀɪᴛʏ ʙᴏᴛ ᴊᴀʀᴠɪs ʙᴏᴛ ɪs ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘ ᴍᴀɴᴀɢᴇʀ ʙᴏᴛ ᴡɪᴛʜ ᴍᴀɴʏ ғᴇᴀᴛᴜʀᴇs. ᴛʜɪs ʙᴏᴛ ʜᴇʟᴘs ʏᴏᴜ ᴛᴏ ᴍᴀɴᴀɢᴇ ʏᴏᴜʀ ɢʀᴏᴜᴘs ᴇᴀsɪʟʏ. ᴏʀɪɢɪɴᴀʟʟʏ ᴀ

1 Dec 11, 2021
A simple Python TDLib wrapper

Telegram Forwarder App Description pywtdlib (Python Wrapper TDLib) is a simple synchronous Python wrapper that makes you easy to create new Python Tel

Álvaro Fernández 2 Jan 04, 2023
A simple use library for bot discord.py developers

Discord Bot Template It's a simple use library for bot discord.py developers. Ob

Tir Omar 0 Oct 16, 2022