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)
Elemeno.ai standard development kit in Python

Overview A set of glue code and utilities to make using elemeno AI platform a smooth experience Free software: Apache Software License 2.0 Installatio

Elemeno AI 3 Dec 14, 2022
Boto is a Python package that provides interfaces to Amazon Web Services.

Boto is a Python package that provides interfaces to Amazon Web Services.

the boto project 6.5k Jan 01, 2023
Threat Intel Platform for T-POTs

T-Pot 20.06 runs on Debian (Stable), is based heavily on docker, docker-compose

Deutsche Telekom Security GmbH 4.3k Jan 07, 2023
A feishu bot daily push arxiv latest articles.

arxiv-feishu-bot We develop A simple feishu bot script daily pushes arxiv latest articles. His effect is as follows: Of course, you can also use other

huchi 6 Apr 06, 2022
Discord bot code to stop users that are scamming with fake messages of free discord nitro on servers in order to steal users accounts.

AntiScam Discord bot code to stop users that are scamming with fake messages of free discord nitro on servers in order to steal users accounts. How to

H3cJP 94 Dec 15, 2022
This repository is used to simplify the process of cloning the SSM documents across the AWS regions.

SSM Cloner Introduction This module is created in order to simplify the process of copying the SSM documents from one region to another regions. As an

6 Jun 04, 2022
JAWS Pankration 2021 - DDD on AWS Lambda sample

JAWS Pankration 2021 - DDD on AWS Lambda sample What is this project? This project contains sample code for AWS Lambda with domain models. I presented

Atsushi Fukui 21 Mar 30, 2022
Automatically load stolen cookies from ChromePass

AutoCookie - Automatically loading stolen cookies from ChromePass View Demo · Report Bug · Request Feature Table of Contents About the Project Getting

darkArp 21 Oct 11, 2022
Stack Overflow Error Parser

A python tool that executes python files and opens respective Stack Overflow threads in browser for errors encountered.

Raghavendra Khare 3 Jul 24, 2022
Discord Mass Edit is a unique, purging related Discord tool that differs from the regular mass delete.

Discord Mass Edit is a unique, purging related Discord tool that differs from the regular mass delete. This tool will automatically edit every message in a chosen channel and change it to a random st

c0mpt0 1 Jul 27, 2022
Powerful Telegram Members Scraping and Adding Toolkit

🔥 Genisys V2.1 Powerful Telegram Members Scraping and Adding Toolkit 🔻 Features 🔺 ADDS IN BULK[by user id, not by username] Scrapes and adds to pub

The Cryptonian 16 Mar 01, 2022
This is Pdisk Upload Bot made using Python with Pyrogram Framework. Its capable of uploading direct download link with thumbnail or without thumbnail & with Title Support.

Pdisk-Upload-Bot Introduction This Is PDisk Upload Bot Used To Upload Direct Link To Pdisk With Thumb Support Deploy Heroku Deploy Local Deploy pip in

HEIMAN PICTURES 32 Oct 21, 2022
=>|<= the MsgRoom bot for Windows 96

=|= bot A MsgRoom bot in Python 3 for Windows96.net. The bot joins as =|=, if parameter name_lasts is not true and default_name is =|=. The full

Larry Holst 2 Jun 07, 2022
⚡ ʑɠ ცơɬ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon ⚡

『ʑɠ ცơɬ』 ⚡ ʑɠ ცơɬ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon ⚡ Status Of Bot Telegram 🏪 Dєρℓογ το нєяοκυ Variables APP_ID =

ʑɑʑɓɦɑɪ 0 Feb 12, 2022
Telegram bot for logistic - Telegram bot for logistic

Демонстрационный телеграм-бот для нужд транспортной компании Цель проекта Реализ

M1chigun 1 Feb 05, 2022
Python wrapper for CoWin API's

Cowin Tracker Python API wrapper for CoWin, India's digital platform launched by the government to help citizens register themselves for the vaccinati

Saiprasad Balasubramanian 43 Jun 11, 2022
PunkScape Discord bot to lookup rarities, create diptychs and more.

PunkScape Discord Bot A Discord bot created for the Discord server of PunkScapes, a banner NFT project. It was intially created to lookup rarities of

Akuti 4 Jun 24, 2022
EpikCord.py - This is an API Wrapper for Discord's API for Python

EpikCord.py - This is an API Wrapper for Discord's API for Python! We've decided not to fork discord.py and start completely from scratch for a new, better structuring system!

EpikHost 28 Oct 10, 2022
A Google Charts API for Python, meant to be used as an alternative to matplotlib.

GooPyCharts A Google Charts API for Python 2 and 3, meant to be used as an alternative to matplotlib. Syntax is similar to MATLAB. The goal of this pr

Sagnik Ghosh 202 Oct 04, 2022
Retrieves GitHub Stats via `git_api` and flask.

GitHub User Search Created using Python3 and git_api, coded by JBYT27. About This is a project I decided to make for Kajam, but I decided to choose a

an aspirin 4 May 11, 2022